This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 14 - Pages: 1 - Last Post: 18 Jan 19, 22:34 Last Post By: drmikey
drmikey

Posts: 208
Registered: 22-Dec-2006
adding isUseThumbForFolderIcon to json data
Posted: 4 Apr 18, 20:28
 
  Click to reply to this thread Reply
Not sure this is possible but when I add:
{
"paging":	0,
  "include":	[
	"isUseThumbForFolderIcon"
  ]
}
to data-config.json or
jm = new JSONMaker(engine);
jm.setIncludes(new String[] { "isUseThumbForFolderIcon" });
dataTree = jm.getTreeAsString(rootFolder);
to init.bsh, isUseThumbForFolderIcon is not included in the json output. Is this not an option to include?
RobM

Posts: 3,815
Registered: 4-Aug-2006
Re: adding isUseThumbForFolderIcon to json data
Posted: 4 Apr 18, 20:41   in response to: drmikey in response to: drmikey
 
  Click to reply to this thread Reply
Maybe you need engine.isUseThumbForFolderIcon()
drmikey

Posts: 208
Registered: 22-Dec-2006
Re: adding isUseThumbForFolderIcon to json data
Posted: 4 Apr 18, 20:47   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
Thanks for the suggestion. No Jalbum error using this but no output in the json file.

jm = new JSONMaker(engine);
jm.setIncludes(new String[] { " engine.isUseThumbForFolderIcon()" });
dataTree = jm.getTreeAsString(rootFolder);
RobM

Posts: 3,815
Registered: 4-Aug-2006
Re: adding isUseThumbForFolderIcon to json data
Posted: 4 Apr 18, 20:51   in response to: drmikey in response to: drmikey
 
  Click to reply to this thread Reply
If you are trying to get the value for an individual file, rather than the general setting for the project, it is not so easy.

Edited by: RobM on 18-Jan-2019 21:33
Removed deleted link
RobM

Posts: 3,815
Registered: 4-Aug-2006
Re: adding isUseThumbForFolderIcon to json data
Posted: 4 Apr 18, 23:23   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
Unsure what you are really after, but maybe you could include both iconPath and thumbPath, then test if iconPath exists for a specific album object?
drmikey

Posts: 208
Registered: 22-Dec-2006
Re: adding isUseThumbForFolderIcon to json data
Posted: 4 Apr 18, 23:42   in response to: RobM in response to: RobM
 
  Click to reply to this thread Reply
It's related to a skin I have that uses json in a handlebars template and it's a problem getting the generic folder thumb (long story related to template coding and thumb paths). I could solve it with an if -- else statement in the template related to isUseThumbForFolderIcon being true or false.
davidekholm

Posts: 3,442
Registered: 18-Oct-2002
Re: adding isUseThumbForFolderIcon to json data
Posted: 5 Apr 18, 17:04   in response to: drmikey in response to: drmikey
 
  Click to reply to this thread Reply
engine.isUseThumbForFolderIcon() is a global setting, not something image specific. Why do you want that stuffed inside the JSON data tree?

The includes mechanism only looks at image-specific variables.

To make the JSON file generation more flexible, I plan to allow skin developers to inject arbitrary data into each node. It could look like this (Java example, but similar can be done through JavaScript):
dpm = new JSONMaker(engine);
dpm.forEach((ao, obj) -> {
    if (ao.isHidden()) {
        obj.put("hidden", Boolean.TRUE);
    }
});
drmikey

Posts: 208
Registered: 22-Dec-2006
Re: adding isUseThumbForFolderIcon to json data
Posted: 8 Apr 18, 18:51   in response to: davidekholm in response to: davidekholm
 
  Click to reply to this thread Reply
Another question about this ( hopefully not too confusing)

With the fact that engine.isUseThumbForFolderIcon() is a global setting, if this value is false (i.e., "Use thumbnail for folder icons" is unchecked under advanced) but an individual folder setting still has the checkbox "❤️ Use as folder thumbnail" checked, the generic folder.png width and height is set to the image that has the ❤️, not to the width and height of the actual folder.png. (I am setting the height and width using thumb.width and thumb.height from the json file). Shouldn't setting the global value override the ❤️ checkbox?
JeffTucker

Posts: 8,039
Registered: 31-Jan-2006
Re: adding isUseThumbForFolderIcon to json data
Posted: 8 Apr 18, 18:56   in response to: drmikey in response to: drmikey
 
  Click to reply to this thread Reply
drmikey wrote:
Shouldn't setting the global value override the ❤️ checkbox?

Not really following all of this, but I think you have this backwards. If you check the global Use thumbnail for folder icon, jAlbum automatically selects the first image in the folder. If you don't check that, no image is automatically selected.

In either case, if you explicitly mark one of the images with Use as folder thumbnail, that's what it does. Image-specific always overrides global.
drmikey

Posts: 208
Registered: 22-Dec-2006
Re: adding isUseThumbForFolderIcon to json data
Posted: 8 Apr 18, 19:03   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
Thanks, I am kind of a backwards guy...
Must be the way my javascript handles the json data in my template, independently of Jalbum's settings.
So what is the variable name for the image specific setting?
JeffTucker

Posts: 8,039
Registered: 31-Jan-2006
Re: adding isUseThumbForFolderIcon to json data
Posted: 8 Apr 18, 19:17   in response to: drmikey in response to: drmikey
 
  Click to reply to this thread Reply
There really isn't a variable. If an image has been chosen to represent the folder, then iconPath is void, and thumbPath points to the thumbnail of that image. The thumbWidth and thumbHeight variables should then also be the actual dimensions of the thumbnail, rather than the dimensions of the folder icon.
drmikey

Posts: 208
Registered: 22-Dec-2006
Re: adding isUseThumbForFolderIcon to json data
Posted: 8 Apr 18, 19:25   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
And iconPath has no height or width set if it is not void, at least what I can see in the json data.
JeffTucker

Posts: 8,039
Registered: 31-Jan-2006
Re: adding isUseThumbForFolderIcon to json data
Posted: 8 Apr 18, 19:29   in response to: drmikey in response to: drmikey
 
  Click to reply to this thread Reply
If iconPath exists, there should be a thumbWidth and thumbHeight. Take a look at the index.htt of Minimal, at line 41 - it's calling those variables to do the HTML layout.

I can't speak to what JSON provides. I don't do JSON. Does it have something to do with the Argonauts?
JeffTucker

Posts: 8,039
Registered: 31-Jan-2006
Re: adding isUseThumbForFolderIcon to json data
Posted: 8 Apr 18, 19:37   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
Just did a quick, simple test with Minimal - just a couple of images, and a folder with no representing thumbnail. What I see in data1.json looks like this:
thumb	
path	"res/folder.png"
width	124
height	124
Looks like dimensions, to me. The actual folder.png is 128x128, but the default thumbnail bounds are 124x124, so that's the size it's reporting.

And if I set the thumbnail bounds to 180x180, the dimensions of folder.png are reported as 128x128, as they should be (it won't make folder.png bigger than it really is).
drmikey

Posts: 208
Registered: 22-Dec-2006
Re: adding isUseThumbForFolderIcon to json data
Posted: 8 Apr 18, 19:45   in response to: JeffTucker in response to: JeffTucker
 
  Click to reply to this thread Reply
Thanks for the help. (The Argonauts thank you also).
Legend
Forum admins
Helpful Answer
Correct Answer

Point your RSS reader here for a feed of the latest messages in all forums