WHy isnt my image being saved

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
gilley55
Forum Newbie
Posts: 11
Joined: Tue Aug 19, 2008 10:13 am

WHy isnt my image being saved

Post 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);
 
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: WHy isnt my image being saved

Post 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?
Post Reply