PDA

View Full Version : use toolkit module to remove .jpg


drstuey
07-03-08, 08:39 AM
Hi,

I am using the extra product images module to display extra images.

The code gets the filename of the extra image and writes it into the PROD page. But I would like to be able reference different versions of the image (e.g. medium, large, thumbnail). I can write the code that will add the extension for the different version to the filename, e.g. add "_thumb" to the filename to make the thumbnail version, but the database stores the filename with .jpg.

So for example the extra product images module stores "myimage.jpg" and I add "_thumb" to it, and this makes "myimage.jpg_thumb". Consequently, currently I am storing "myimage" in the database and adding "_thumb.jpg" to it. But this is difficult for the client.

So what I want to do is take "myimage.jpg" from the database, remove the .jpg part and add "_thumb.jpg". Or to just insert "_thumb" before the ".jpg".

Clear?

I understand that Emporium toolkit module can do this.

SO, my question is, how can I use Emporium toolkit module to do this? Which of the toolkit functions should I be using? This is pretty standard programming I guess, but I'm not a programmer.

wcw
07-03-08, 01:51 PM
Use vassign to create a variable you can mess with. Then use sglosub to replace .jpg with _thumb.jpg

drstuey
07-04-08, 04:28 AM
Use vassign to create a variable you can mess with. Then use sglosub to replace .jpg with _thumb.jpg

Thanks Bill,

I tried, oh how I tried, but I can't get the variable to be written into the page. The original ADS_ProdImg variable gets written into the page fine, but if I try to use toolkit to convert that into a toolkit variable I can't get the toolkit variable to be written into the page.

I used latu's storehelper module to check what variables were available to the page and it said there was a variable called 1.settings:ads_prodimgs_img2. But I couldn't manage to use toolkit to convert that to a toolkit variable. I tried:

mvt:item name="toolkit" param="vassign|ads_prodimgs_img2_sm|l.all_settings:ads_pr odimgs_img2"

mvt:item name="toolkit" param="vassign|ads_prodimgs_img2_sm|l.settings:ads_prodim gs_img2"

mvt:item name="toolkit" param="vassign|ads_prodimgs_img2_sm|ads_prodimgs_img2"

The toolkit item is definitely assigned to the page because I am also calculating a You save: percentage value using toolkit.

wcw
07-04-08, 04:37 AM
One of those should have gotten it. What code are you using to test if the variable was assigned to the new variable?

It is probably just a typo in l.all_settings :ads_prodimgs_img2 above. You have a space between s and :