I have been trying to check if a media string is empty or not. I want to set different variables to ImageGen if the string contains no media (to set a "No picture" text instead of "Hello world"). This does not apply for a string containing any other media, since ImageGen would write the text on top of that image?
Heres some of my code - it should be fairly easy to do I think :)
You can certainly simplify your xslt a lot (example shown below), but there's an even easier way to automatically handle missing images with ImageGen...
Create an image to display when the requested image is missing. To do this, create an image that suits your needs, say one that is 250x200 in size with the text NO-PICTURE on it. Save it as a file to your website. Let's assume this is saved in the file, /media/no-picture.jpg. You could then use the following in your xslt:
Check if media exists and do
Hi.
I have been trying to check if a media string is empty or not. I want to set different variables to ImageGen if the string contains no media (to set a "No picture" text instead of "Hello world"). This does not apply for a string containing any other media, since ImageGen would write the text on top of that image?
Heres some of my code - it should be fairly easy to do I think :)
Any suggestions? I can get it to work one way or another - but not both ways.
Thanks.
Hi Stefan, could you elaborate a bit on the problem - what works and what doesn't? What happens when it doesn't work?
>Tommy
You can certainly simplify your xslt a lot (example shown below), but there's an even easier way to automatically handle missing images with ImageGen...
Create an image to display when the requested image is missing. To do this, create an image that suits your needs, say one that is 250x200 in size with the text NO-PICTURE on it. Save it as a file to your website. Let's assume this is saved in the file, /media/no-picture.jpg. You could then use the following in your xslt:
That uses the altImage= parameter in ImageGen, which will show the alternate image only if the image= parameter has no file associated with it.
But, if you wanted to do something like your original question in xslt rather than with the altImage= parameter, I'd simplify it to this:
cheers,
doug.
Hi Douglas!
Thank you for the exact and well-explained answer(s). Didn't know about the altImage option in ImageGen.
Will certainly test the two possibilities :)
Thanks again!
is working on a reply...