Page 1 of 1

WHy isnt my image being saved

Posted: Mon Sep 01, 2008 6:35 am
by gilley55
i am trying to save an image that is produced by the Draw function using the imagepng() function but is not working can some one explain? the code runs fine no errors but the save part isn't working.

Thanks in advance.

Code: Select all

    
if(isValid($value)==true){
    Image_Barcode::draw($value, 'upca', 'png');
$barcode=ob_get_contents();
setcookie("barcode", $barcode, time()+3600);
ob_get_clean();
echo $barcode;
$png=".png";
$upc_image=$value.$png;
 
 
//$image = rename($barcode,$upc_image);
$file_location="htdocs/canada/0123454567890824.png";
  imagepng($image,$file_location,0,NULL);
 

Re: WHy isnt my image being saved

Posted: Mon Sep 01, 2008 6:56 am
by onion2k
Does PHP have permission to write to the directory you're trying to save to?

Also, the last parameter should really be PNG_NO_FILTER rather than NULL if you're going to specify it.

EDIT: Where are you defining $image?