I am trying to use a php script in the advanced user guide, which automatically resizes the product image. Heres the code from the user guide.
When I try this I get the following error?
Any suggestions?
Thanks.
Code:
<actinic:block if="%3cactinic%3avariable%20name%3d%22IsPopUpDisplayedByImage%22%20%2f%3e"> <actinic:block if="%3cactinic%3avariable%20name%3d%22ExtendedInformationType%22%20%2f%3e%20%3d%3d%20%22Opens%20in%20a%20Pop%2dUp%20Window%22"> <a href="javascript:ShowPopUp('<actinic:variable name=ExtendedInfoPageEncoded />',<actinic:variable name="ExtInfoWindowWidth" />,<actinic:variable name="ExtInfoWindowHeight" />);"> </actinic:block> <actinic:block if="%3cactinic%3avariable%20name%3d%22ExtendedInformationType%22%20%2f%3e%20%3d%3d%20%22Opens%20in%20the%20Same%20Window%22" > <a href="<actinic:variable name="ExtendedInfoPageName" />"> </actinic:block> </actinic:block> <actinic:block if="%3cactinic%3avariable%20name%3d%22IsProductImageDisplayed%22%20%2f%3e"> <actinic:block php="true" > // START Create a thumbnail image t_ProductImageFileName $sOriginalImageName = '<actinic:variable encoding="perl" name="ProductImageFileName" selectable="false" />'; $sThumbImageName = 't_' . $sOriginalImageName; $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 = 100; $t_height = $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 "<br><img src=\"$sThumbImageName\" width=\"$t_width\" height=\"$t_height\" border=\"0\" />"; } } // END Create a thumbnail image t_ProductImageFileName </actinic:block> </actinic:block> <actinic:block if="%3cactinic%3avariable%20name%3d%22IsProductImageDisplayed%22%20%2f%3e%20%3d%3d%20False"> <img src="<actinic:variable name="DefaultProductImage" />" border="0" alt="<actinic:variable name="ProductName" />" /> </actinic:block> <actinic:block if="%3cactinic%3avariable%20name%3d%22IsPopUpDisplayedByImage%22%20%2f%3e"> </a> </actinic:block>
Code:
Warning: imagejpeg(): Unable to open 't_Medium_Images\Haglof-Rucksacks\medium_haglofs_matrix_charcoal_2.jpg' for writing in main on line 21 Thumbnail image creation failed: t_Medium_Images\Haglof-Rucksacks\medium_haglofs_matrix_charcoal_2.jpg
Thanks.
Comment