|
Replies:
14
-
Pages:
1
-
Last Post:
30 Nov 18, 16:39
Last Post By: JeffTucker
|
Threads:
[
Previous
|
Next
]
|
|
Posts:
1,289
Registered:
14-Dec-2007
|
|
|
How to get the number of images including web locations?
Posted:
30 Nov 18, 13:54
|
|
|
I have an album with 4 web locations and one folder.
I like to know the number of images ( normal images + videos + web locations) in this album excluding the folders.
I tried this:
CategoryCounters cc = JAlbumUtilities.countCategories(currentFolder, false);
int nrofImages= cc.getCount(Category.image) + cc.getCount(Category.video) + cc.getCount(Category.webPage);
But this gives nrofimages=0
I get the correct value with this code:
<% nrofImages=0; %>
<ja:fileiterator start="0" ><ja:if exists="folder"> </ja:if>
<ja:else>
<% nrofImages ++; %>
</ja:else></ja:fileiterator>
This works: nrofimages=4
Global variable indexImageCount reports 5, so that includes the folder.
Why is the first code block not working?
In which category are web locations?
The documentation does not help me!
Edit:
Also the for me complicated API documentation does not help me: countCategories(List<AlbumObject>, CategoryCounters, boolean) - Static method in class se.datadosen.jalbum.JAlbumUtilities
For jAlbum use only
countCategories(AlbumObject) - Static method in class se.datadosen.jalbum.JAlbumUtilities
Return an object holding the number of objects per category under this folder.
Usage examples:
JAlbumUtilities.countCategories(currentFolder).getCount(Category.image); // Get number of images in current folder
JAlbumUtilities.countCategories(currentFolder).getCount(Category.webPage); // Get number of web pages in current folder
JAlbumUtilities.countCategories(currentFolder).getTotalCount()); // Get total number of objects in current folder
JAlbumUtilities.countCategories(currentFolder).getFileCount()); // Get total number of files (not folders) in current folder
JAlbumUtilities.countCategories(rootFolder, true); // Get total number of objects per category in album
countCategories(AlbumObject, boolean) - Static method in class se.datadosen.jalbum.JAlbumUtilities
countCategories(AlbumObject, CategoryCounters, boolean) - Static method in class se.datadosen.jalbum.JAlbumUtilities
Return an object holding the number of objects per category under this folder
Where is the explanation of the 2nd argument of the countCategories function?
Edited by: AndreWolff on 30-Nov-2018 14:03
|
|
|
Posts:
3,815
Registered:
4-Aug-2006
|
|
|
Re: How to get the number of images including web locations?
Posted:
30 Nov 18, 14:19
in response to: AndreWolff
|
|
|
Little wonder, as it is the wrong page to look at - category counters are not variables. The developer documentation has examples, as you very well know given your statement ‘have 12 years experience with jAlbum and did develop 4 skins, so I know what I am doing.’
Edit:
Also the for me complicated API documentation does not help me: countCategories(List<AlbumObject>, CategoryCounters, boolean) - Static method in class se.datadosen.jalbum.JAlbumUtilities
For jAlbum use only
countCategories(AlbumObject) - Static method in class se.datadosen.jalbum.JAlbumUtilities
Return an object holding the number of objects per category under this folder.
Usage examples:
JAlbumUtilities.countCategories(currentFolder).getCount(Category.image); // Get number of images in current folder
JAlbumUtilities.countCategories(currentFolder).getCount(Category.webPage); // Get number of web pages in current folder
JAlbumUtilities.countCategories(currentFolder).getTotalCount()); // Get total number of objects in current folder
JAlbumUtilities.countCategories(currentFolder).getFileCount()); // Get total number of files (not folders) in current folder
JAlbumUtilities.countCategories(rootFolder, true); // Get total number of objects per category in album
countCategories(AlbumObject, boolean) - Static method in class se.datadosen.jalbum.JAlbumUtilities
countCategories(AlbumObject, CategoryCounters, boolean) - Static method in class se.datadosen.jalbum.JAlbumUtilities
Return an object holding the number of objects per category under this folder
Where is the explanation of the 2nd argument of the countCategories function?
It is there, in your question, as well as in the developer documentation.
|
|
|
Posts:
1,289
Registered:
14-Dec-2007
|
|
|
Re: How to get the number of images including web locations?
Posted:
30 Nov 18, 14:53
in response to: RobM
|
|
|
It is there, in your question, as well as in the developer documentation.
2x bullshit and you did not answer my question.
So if your only goal is to damage me, your better keep your mouth!
|
|
|
Posts:
3,442
Registered:
18-Oct-2002
|
|
|
Re: How to get the number of images including web locations?
Posted:
30 Nov 18, 14:57
in response to: AndreWolff
|
|
|
|
|
Posts:
1,289
Registered:
14-Dec-2007
|
|
|
Re: How to get the number of images including web locations?
Posted:
30 Nov 18, 15:25
in response to: davidekholm
|
|
|
Drop that ", false" part, it excludes sub folders.
Well I did what you adviced: CategoryCounters cc = JAlbumUtilities.countCategories(currentFolder);
int totalFolders = cc.getCount(Category.folder);
int nrofImages= cc.getCount(Category.image) + cc.getCount(Category.video) + cc.getCount(Category.webPage);
but that does not work, I get nrofImages=20, this inclkudes the nr of images in a subfolder and that is not what I want.
|
|
|
Posts:
3,442
Registered:
18-Oct-2002
|
|
|
Re: How to get the number of images including web locations?
Posted:
30 Nov 18, 15:32
in response to: AndreWolff
|
|
|
Ok. If you don't want sub folders included, then you need to specify ", false" too. If you're saying it doesn't sum the objects correctly, please zip a minimal project demonstrating this and attach it here.
|
|
|
Posts:
1,289
Registered:
14-Dec-2007
|
|
|
Re: How to get the number of images including web locations?
Posted:
30 Nov 18, 15:33
in response to: davidekholm
|
|
|
Try doing a <% System.out.println(cc) %> to get an overview of all counters printed to the system console.
This shows that there is a category weblocation, which is not indicated in the documenmtation !!
|
|
|
Posts:
1,289
Registered:
14-Dec-2007
|
|
|
Re: How to get the number of images including web locations?
Posted:
30 Nov 18, 15:42
in response to: davidekholm
|
|
|
These are the correct answers: CategoryCounters cc = JAlbumUtilities.countCategories(currentFolder,false);
int totalFolders = cc.getCount(Category.folder);
int nrofImages= cc.getCount(Category.image) + cc.getCount(Category.video) + cc.getCount(Category.webLocation);
or int nrofImages= indexImageCount - totalFolders
Thanks for your help!
|
|
|
Posts:
8,039
Registered:
31-Jan-2006
|
|
|
Re: How to get the number of images including web locations?
Posted:
30 Nov 18, 15:45
in response to: AndreWolff
|
|
|
|
|
Posts:
1,289
Registered:
14-Dec-2007
|
|
|
Re: How to get the number of images including web locations?
Posted:
30 Nov 18, 15:53
in response to: JeffTucker
|
|
|
Another guy who only like to damage me:
Look in documentation it says:
fileCategory Category. Possible values are image, folder, video, audio, webPage, other of type Category
where is webLocation?
|
|
|
Posts:
8,039
Registered:
31-Jan-2006
|
|
|
Re: How to get the number of images including web locations?
Posted:
30 Nov 18, 15:56
in response to: AndreWolff
|
|
|
It's a wiki. If you find information that's out of date, as this tidbit is, then fix it, and stop whining about it. The API is the official source - everything else is user-created by volunteers in their spare time.
Lord, this is like dealing with a particularly unpleasant 9-year-old.
|
|
|
Posts:
1,289
Registered:
14-Dec-2007
|
|
|
Re: How to get the number of images including web locations?
Posted:
30 Nov 18, 16:32
in response to: JeffTucker
|
|
|
It's a wiki. If you find information that's out of date, as this tidbit is, then fix it, and stop whining about it. The API is the official source - everything else is user-created by volunteers in their spare time
I can’t fix iT, because I have no permission and I don’t want to correct iT, because English is not my natural language.
So I just indicates the documentaties errors, but the volunteered documentation writer sees this as an insult.
In the API, the official source, is no category webLocation geven in the examples.
|
|
|
Posts:
3,815
Registered:
4-Aug-2006
|
|
|
Re: How to get the number of images including web locations?
Posted:
30 Nov 18, 16:32
in response to: JeffTucker
|
|
|
It's a wiki. If you find information that's out of date, as this tidbit is, then fix it, and stop whining about it. The API is the official source - everything else is user-created by volunteers in their spare time.
Since this was a scripting question the correct page to look at for this is in Developer centre, Manuals, Scripting: Sample scripts
|
|
|
Posts:
8,039
Registered:
31-Jan-2006
|
|
|
Re: How to get the number of images including web locations?
Posted:
30 Nov 18, 16:39
in response to: AndreWolff
|
|
|
|
In the API, the official source, is no category webLocation geven in the examples.
|
|
|
|
Legend
|
|
Forum admins
|
|
Helpful Answer
|
|
Correct Answer
|
|