Chris - did you get my email?
Announcement
Collapse
No announcement yet.
Advanced Guide Article Update - Auto Sized Product Images
Collapse
X
-
Post details of your section file names, where they are located and the exact error message.Norman - www.drillpine.biz
Edinburgh, U K / Bitez, Turkey
Comment
-
Section problems
Hi
I've modified Norman's code (thanks Norman) to generate section thumbnails. (i used the Product Thumbnail Code and that works perfectly!!!Here's the modified Section one: (including the formatting for the "Section Link Within a box").
This gives me a thumbmail creation error.
Maybe Chris & Jonty solved it above, but who knows????
Any ideas??
Code:<a href="<actinic:block if="%3cactinic%3avariable%20name%3d%22IsLoginPageSuppressed%22%20%2f%3e%20AND%0d%3cactinic%3avariable%20name%3d%22UnregCustomersAreNotAllowed%22%20%2f%3e" ><actinic:variable name="SectionPageName" /></actinic:block><actinic:block if="%28%3cactinic%3avariable%20name%3d%22IsLoginPageSuppressed%22%20%2f%3e%20%3d%3d%20false%29%20OR%0d%28%3cactinic%3avariable%20name%3d%22UnregCustomersAreNotAllowed%22%20%2f%3e%20%3d%3d%20false%29" ><actinic:variable name="SectionURL" /></actinic:block>" target="_self"> <actinic:block php="true" > // START Create a thumbnail image s_SectionImageFileName $sOriginalImageName = str_replace('\\','/', '<actinic:variable name="SectionImageFileName" encoding="perl" selectable="false" />'); $nScaledWidth = <actinic:variable name="SectionImageScaledWidth" encoding="perl" selectable="false" />; $sThumbImageName = 'Thumbnails/s_' . basename($sOriginalImageName); if (file_exists($sThumbImageName)) { echo "<img src=\"$sThumbImageName\" border=\"0\""; echo " alt=\"<actinic:variable name="SectionName" encoding="strip"/>\" />"; } else { $image = @imagecreatefromjpeg($sOriginalImageName); /* Attempt to open */ if (!$image) { /* See if it failed */ echo "<br><font color=red>Thumbnail creation error opening: $sOriginalImageName </font>"; } else { // Get new dimensions $width = imagesx($image); $height = imagesy($image); $t_width = $nScaledWidth; $t_height = round($height * ($t_width / $width)); // Resample $thumbimage = imagecreatetruecolor($t_width, $t_height); imagecopyresampled($thumbimage, $image, 0, 0, 0, 0, $t_width, $t_height, $width, $height); if ( ! imagejpeg($thumbimage, $sThumbImageName) ) { echo "<font color=red>Thumbnail image creation failed: $sThumbImageName </font><br>"; } else { echo "<img src=\"$sThumbImageName\" width=\"$t_width\" height=\"$t_height\" border=\"0\""; echo " alt=\"<actinic:variable name="SectionName" encoding="strip"/>\" />"; } } } // END Create a thumbnail image s_SectionImageFileName </actinic:block>
Best wishes
Aled
P.S see attached imageAttached Files
Comment
-
problem when auto-resizing section images
Hello,
I have used this code to re-size the product images, which has worked perfectly - THANK YOU for such a fantastic time-saving device.
I also want to automatically re-size the section images, and have followed the instructions, and it all works perfectly until I change the ProductImageScaledWidth to the SectionImageScaledWidth (which I have set up as described). Once I change this variable, I get the error message:
Parse error: syntax error, unexpected '<' in main on line 4
This message persists even when I change back to the ProductImageScaledWidth which did work.
This message becomes "Thumbnail creation error opening: der020.jpg" when I upload - this can be seen on the first product on the following page.
http://www.guidepost.uk.com/shop/aca...YSHIRE_40.html
I am going round in circles, so any help would be greatly appreciated.
Thanks,
Rosalyn
Comment
-
Section images
Hello,
I have solved my problem by using:
http://community.actinic.com/showthr...section+images
Now all is well!
Rosalyn
Comment
-
help
I have been over and over and over, and I still cannot get this to work on my site!?
May be its something I've done wrong?
I get the follow errors where picture should be,
Warning: imagecreatetruecolor(): Invalid image dimensions in main on line 19 Warning: imagecopyresampled(): supplied argument is not a valid Image resource in main on line 20 Warning: imagejpeg(): supplied argument is not a valid Image resource in main on line 21
Thumbnail image creation failed: Thumbnails/t_KE24145J05NY.JPG
Please can someone point me in the right direction
Yours hopefully
Neil
www.gparts.co.uk
Comment
-
Thumbnail file name size limitation - length
With the thumbnail setup in the Advanced Guide Article, is there a known limitation on the length of the filename. for example I have some images that have quirky names like - 129314398194083750AP1024E-DDR310600.jpg. There is a problem with creating the thumbnail images and I suspect that it is the name format.
If I set the Layout to standard images it works fine, albeit the images are not scaled. I could change the image names, but it is a big schlep!!
Any ideas please?
Adrian Boshoff
http://www.servatech.co.za
Comment
-
A lot of my add-ons automatically create images with deliberately long names and I've not seen any problems. E.g.
dcr_19f7f135815ad2503b18609a2186507b_150_195_ffffff_100.jpg
There is a good reason for this. These images are based on existing Actinic ones that have been scaled, borders possibly added and saved at a specific JPEG compression.
In the example above the filename consists of:
dcr Type of resultant image (a Dynamic Choice Images replacement product image).
19f7f135815ad2503b18609a2186507b The MD5 of the user supplied image this is based on.
150 The width of the resulting image.
195 The height of the resulting image.
ffffff The colour of any borders.
100 The JPEG compression used.
The reason for the above is that if an image already exists with this filename, then it must have been created from the same original image using identical parameters. This means that I don't need to re-create the image (which is computationally expensive). It also might be re-uploaded by Actinic as its timestamp would have changed.Norman - www.drillpine.biz
Edinburgh, U K / Bitez, Turkey
Comment
-
Auto Sized Product Images error
Hi all,
I have used the the auto sizing coding supplied by Norman and it looks brilliant - thank you Norman.
However, I am getting this error :
a PHP error has been found on the page ('Parse error: parse error, expecting '," or ';" in main on line 28'). The error is coming from the 'Thumbnail Product Image' layout. Click here to go to the code. (2 places)
Could anyone please help me with this? Ive searched the forums and cant find anything
Comment
-
thumbnail images upload on every upload
Hi Norman,
the code works great only it seems to want to upload the thumbnails on every upload.
It wouldnt be a problem if the site was small. My site has 9000 images. Is there a way to make the website treat the thumbnails like the normal images where it only uploads them if it finds that the files have changed?
thanks
Mario
Comment
-
That's because the code doesn't know if you've changed the original image or not so has to create new thumbnails each run. Actinic sees the new timestamp and uploads them.
My commercial add-ons only re-create their images if some-thing's changed. There's about another 200 lines of PHP required. A significant amount of work and code I'm not willing to give away for free.
I have an add-on Auto Product Images that may help. Here are some notes from its' ReadMe:
Auto Product Images V2.01 - for Actinic 8.5.1 onwards.
This patch provides an alternative Product Image layout that allows
you to use any size of image as your Product Image. This image is rescaled
to provide a fixed size product image that is used instead.
It also creates if required a (optionally different sized) Extended Info Image.
Optionally, it can also create a larger image that appears when you place
the mouse over the Product Image.
You set the dimensions of the various images (Product / Extended Info / New Products / Recent Products, etc)
via Variables so it’s easy to fine-tune for different sites.Norman - www.drillpine.biz
Edinburgh, U K / Bitez, Turkey
Comment
Comment