Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Hi Res and Thumbnail images
lizb
Hi all,
In my dct I need to capture a hi res image and a thumbnail image. Both have the same path and the same image name except the thumbnail is prepended with th_. I would like the user to only have to select the hi res image and then I can have the dct fill in the thumbnail field.
I am looking for any sample code that anyone might have to get me started....Thanks
Find more posts tagged with
Comments
Jens
You can use FormApi.
get the item value of your pic,
write a little regex to set tn_ in front of pic-name
and set value to item for thumb.
Ciao,
Jens
herald10
You can use FormAPI to accomplish it. Associate an item handler with the field that user is going to fill up. When ever that item changes, change the other field accordingly in the item handler function. There are a lot of formapi examples under the directory: iwhome/examples/Templating/templatedata/userscript
Hope that helps
Dwayne
The FormAPI stuff suggested works if you want the thumbnail image to be stored as a part of the DCR.
If, instead, you only want the base image stored in the DCR, and then calculate the thumbnail path in the PT, you could use something like this:
<iw_perl><[CDATA[
($thumbnail = iwpt_dcr_value('dcr.Image')) =~ s|(.*/)(.*)$|$1th_$2|;
]]></iw_perl>
and then use
<img src='{iw_value name="$thumbnail"/}'>
The regex puts 'th_' immediately after the last '/' with everything else intact
nipper
Will part of your plan be a script that automagically runs a program to convert the
image to a thumbnail ? Or is the thumbnail already in place ? If the latter, then the
post with the regex to convert the image to tn_image will work nicely.
HTH
Andy