|
Hi all,
I had designed the product customization module for product and i am able to save the new customized image at new location say /magento/tempimg/myimg.jpeg. now when the order is placed (i.e. checkout is done) i want to rename this image with the order number generated. So I am trying to rename this file in magento/app/design/frontend/default/default/template/checkout/success.phtml. I am trying to do this using image GD library. but i am constantly getting the error Warning: imagepng() [function.imagepng]: Unable to open ‘img path’ for writing: No such file or directory in ....../magento/app/design/frontend/default/default/template/checkout/success.phtml.
the image code:
$newimgname = “http://localhost/magento/tempimg/”.$this->getOrderId()."_”.$_SESSION[’itemno’].".png";
$im = imagecreatefromjpeg(’mysource img’); //i.e. ../magento/tempimg/myimg.jpeg
$width = imagesx($im);
$height = imagesy($im);
$im_dest=imagecreatetruecolor($width, $height);
imagecopy($im_dest,$im,0,$height,0, $height,$width, $height);
header(’Content-type: image/jpeg’);
imagepng($im_dest,$newimgname);
imagedestroy($im);
imagedestroy($im_dest);
Any idea what i am doing worng.
Any help would be great..
Thanks in Advance..
Nils123
|