nevynev Posted August 12, 2007 Share Posted August 12, 2007 I cant seem to be able to output the output as a file which I can then move to "/directoryforjpegs/". Im probably being stupid! See the function below <? function gif2jpeg($p_fl, $p_new_fl='', $bgcolor=false){ list($wd, $ht, $tp, $at)=getimagesize($p_fl); $img_src=imagecreatefromgif($p_fl); $img_dst=imagecreatetruecolor($wd,$ht); $clr['red']=255; $clr['green']=255; $clr['blue']=255; if(is_array($bgcolor)) $clr=$bgcolor; $kek=imagecolorallocate($img_dst, $clr['red'],$clr['green'],$clr['blue']); imagefill($img_dst,0,0,$kek); imagecopyresampled($img_dst, $img_src, 0, 0, 0, 0, $wd, $ht, $wd, $ht); $draw=true; if(strlen($p_new_fl)>0){ if($hnd=fopen($p_new_fl,'w')){ $draw=false; fclose($hnd); } } if(true==$draw){ header("Content-type: image/jpeg"); imagejpeg($img_dst); }else imagejpeg($img_dst, $p_new_fl); imagedestroy($img_dst); imagedestroy($img_src); } $fl='PeriodicTable.gif'; $c['red']=255; $c['green']=0; $c['blue']=0; gif2jpeg($fl, '', $c); ?> Thanks NevyNev Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.