|
Replies:
16
-
Pages:
2
[
1
2
| Next
]
-
Last Post:
09-Mar-2017 13:13
Last Post By: davidekholm
|
|
|
Posts:
457
Registered:
12-Nov-2003
|
|
|
User variables
Posted:
04-Mar-2017 12:06
|
|
|
A user is manually changing maxImageWidth by setting a user variable for individual images.
This crashes album generation when performing calculations with it, since the variable is of type String in this case.
Any ideas how to solve this?
|
|
|
Posts:
3,107
Registered:
4-Aug-2006
|
|
|
Re: User variables
Posted:
04-Mar-2017 13:09
in response to: Dschuwi
|
|
|
You could use if (variable instanceof Integer)
or instance of String, to test what you have. But maybe jAlbum core should convert those specific user variables to match the values of the normal image bounds?
|
|
|
Posts:
457
Registered:
12-Nov-2003
|
|
|
Re: User variables
Posted:
04-Mar-2017 15:14
in response to: RobM
|
|
|
You could use if (variable instanceof Integer)
or instance of String, to test what you have. But maybe jAlbum core should convert those specific user variables to match the values of the normal image bounds?
I tried this, it works basically to test the user variable, which is of type String. However, other users might come up with other ideas to overrule jAlbum and/or the skin, so I would end up to check every possible variable if it still is of the type CA2 expects under regular circumstances.
Strange though, I cannot determine the type of maxImageWidth as provided by jAlbum that way. It is not String, Integer, Float, Long or Double - what is it?
|
|
|
Posts:
7,369
Registered:
31-Jan-2006
|
|
|
Re: User variables
Posted:
04-Mar-2017 15:32
in response to: Dschuwi
|
|
|
Strange though, I cannot determine the type of maxImageWidth as provided by jAlbum that way. It is not String, Integer, Float, Long or Double - what is it?
It's a bsh.Primitive. Not much help, I know, but there you have it!
Edit: A variable declared under Settings > Advanced > User Variables is the same type. But a variable declared for an individual image comes back as a String. Something for David to ponder....
|
|
|
Posts:
457
Registered:
12-Nov-2003
|
|
|
Re: User variables
Posted:
04-Mar-2017 15:47
in response to: jGromit
|
|
|
Well, this is at least some knowledge
Back to the the initial problem: Is there a way for the user to defne his user variable as Integer, or does the skin have to catch this, indeed? I.e. the skin has to provide support for his special user case?
|
|
|
Posts:
7,369
Registered:
31-Jan-2006
|
|
|
Re: User variables
Posted:
04-Mar-2017 16:14
in response to: Dschuwi
|
|
|
Is there a way for the user to defne his user variable as Integer....
As far as I can tell, no. If the skin sets up a custom UI, of course, it can control the data types, but when using the built-in image-level variables, it looks like you're stuck with a String.
|
|
|
Posts:
3,107
Registered:
4-Aug-2006
|
|
|
Re: User variables
Posted:
04-Mar-2017 16:29
in response to: Dschuwi
|
|
|
I tried this, it works basically to test the user variable, which is of type String. However, other users might come up with other ideas to overrule jAlbum and/or the skin, so I would end up to check every possible variable if it still is of the type CA2 expects under regular circumstances.
Since maxImageWidth, for example, is a core variable I think the value returned from its use as a custom variable should be of the same type as the maxImageWidth from the settings page. Skin variables though are up to the skin developer to deal with.
|
|
|
Posts:
457
Registered:
12-Nov-2003
|
|
|
Re: User variables
Posted:
04-Mar-2017 17:27
in response to: RobM
|
|
|
Since maxImageWidth, for example, is a core variable I think the value returned from its use as a custom variable should be of the same type as the maxImageWidth from the settings page.
I agree.
|
|
|
Posts:
3,564
Registered:
18-Oct-2002
|
|
|
Re: User variables
Posted:
06-Mar-2017 16:58
in response to: Dschuwi
|
|
|
A user is manually changing maxImageWidth by setting a user variable for individual images.
This crashes album generation when performing calculations with it, since the variable is of type String in this case.
Any ideas how to solve this?
Does he want to mix panoramics with ordinary images? In that case, simply set image bounds to an extreme, like 10000x800 for instance.
|
|
|
Posts:
7,369
Registered:
31-Jan-2006
|
|
|
Re: User variables
Posted:
06-Mar-2017 17:39
in response to: davidekholm
|
|
|
Does he want to mix panoramics with ordinary images? In that case, simply set image bounds to an extreme, like 10000x800 for instance.
That's not always feasible.
Take Matrix, for example. Normal slide images are fully responsive, so you want image bounds like 1600x750. But pano's have a fixed height, so you don't want to use 750 as the height. For a pano, you might want image bounds of 10000x400. Applying those extreme bounds to the regular images makes them all too short to take advantage of the viewport, but using 10000x750 makes the pano too tall.
(Edit: BTW, the fact that it's a String doesn't cause any problems in Matrix because I'm just using the value to plug into the HTML. I'm not actually doing any math with it.)
Edited by: jGromit on 06-Mar-2017 12:45
|
|
|
Posts:
457
Registered:
12-Nov-2003
|
|
|
Re: User variables
Posted:
06-Mar-2017 23:23
in response to: davidekholm
|
|
|
Does he want to mix panoramics with ordinary images? In that case, simply set image bounds to an extreme, like 10000x800 for instance.
Yes, but then these image bounds would apply to all other images as well.
I believe it is a legit request to change bounds (or whatever variable) on a per image basis.
The point is: jAlbum makes it possible by manually setting user variables which override album wide settings, which is great. However, maxImageWidth provided by jAlbum is a number, overridden by a user variable it is a string though, which seems odd.
So I second the idea that any user varible which overrides a jAlbum variable should automatically be of the same type.
I have overcome the crash problem meanwhile and let CA2 perform a test on this variable, so panoramic image support is going to be a "feature" of the next release 
|
|
|
Posts:
1,749
Registered:
14-Dec-2007
|
|
|
Posts:
3,564
Registered:
18-Oct-2002
|
|
|
Re: User variables
Posted:
08-Mar-2017 11:37
in response to: AndreWolff
|
|
|
The upcoming jAlbum version now tries to set proper data types for image specific user variables. Here's the mapping that's currently performed:
A value that can be represented as a double number is converted to double
A values that can be represented as an integer is converted to int
If neither of these conditions holds, the value is kept as a String.
If you want to try the beta, it's here: http://jalbum.net/download/beta/jalbum-core.jar
|
|
|
Posts:
457
Registered:
12-Nov-2003
|
|
|
Re: User variables
Posted:
08-Mar-2017 12:16
in response to: davidekholm
|
|
|
Great, it works like a charm, tested for my special use case. Thanks!
|
|
|
|
Legend
|
|
Forum admins
|
|
Helpful Answer
|
|
Correct Answer
|
|