I'm creating a script to get all the pictures used in the project.
What I need to do is to get the exact resolution used in that usage, but I don't know if that's possible, any ideas?
Thank you in advance,
that information is just "not existing" in the object model because the resolution is "used"/"defined" upon generation time only. So it's "dynamic" information which is not stored and therefore cannot be queried. So either way you try to solve this, it will always need a full generation.
Theoretically, you could use a rendertemplate to handle every $CMS_REF(...)$ call and "remember" the given resolution and image somewhere (e.g. in a schedule context property) and create statistics from those remembered values after each generation. But the effort to change all the template would be quite high.
Another option would be to just work on the generated files (scan the html) which is also not that easy.
Thanks for your reply. I'm a bit disappointed about this, to be honest.. but maybe I didn't explain myself very well.
I'm getting all the MEDIA from the project. After that, I'm selecting the pictures and finally I check the incomingReferences.
I mean, I should be able to know if a resolution was selected since I'm getting the image and its reference... or not?
Once again, thank you,
"getting" the resolution is done in the template code, i.e. upon rendering the output. You could compare it to an information that only exists "at runtime" but not in the data model. There, it is only known that an image is referenced (usually using a FS_REFERENCE). Strictly speaking, it is not even sure that the image is "really" used because the $CMS_REF(...)$ statement could (theoretically) be inside a $CMS_IF(...)$ which could "suppress" the image.
So at the end the only option would be to "observe" the generation and "remember" the requested resolution(s) for each image - that was the rendertemplate approach.
Thanks for your very quick response.
I had a minimal hope that my first question wasn't clear because it's really hard to me understand how First Spirit cannot resolve easily these kind of 'elemental' things.
Anyway, thanks for your support.
you could also iterate over all created media files in the schedule directory. Most URL Creators are rendering the name of the resolution into the file name of the media file.
Since you haven't specified, for what you need the exact resolution, it is very difficult to give you an answer, which helps you to solve the problem you have.
Maybe you should ask for a possible solution for the problem itself instead of asking for a how-to for the way, which you try to solve the problem with
I'm ok with the answer that there's no easy way to get the used resolution for an image in the template. I don't know what more information do you need or why you're saying that I'm not giving an specific information about why I need the resolution.
I think First Spirit isn't helpful with developers in many things, this one of them.
To be honest, I don't think this alternative solution is more helpful than the previous options Michael gave me.
I repeat, if FS cannot help me with this, it's ok, but please don't tell me that I'm not being specific when the question was very simple.