Jump to content

how to install GD


corillo181

Recommended Posts

so why do i keep on getting this error

 

imagesx(): supplied argument is not a valid Image resource in

these is how i set it up

upLoadPicture($galleryid,$picture,$descrive,$save,$width){
$widthx=imagesx($picture);
$heighty=imagesy($picture);

if($widthx>600){
$srcImg=imagecreatefromjpeg("$picture");
$ratio=$widthx/$width;
$thumbHeight=$heighty*$ratio;
$thumbImg=imagecreate($Width,$thumbHeight);
imagecopyresized($thumbImg,$srcImg,0,0,0,0,$Width,$thumbHeight,imagesx($thumbImg),imagesy($thumbImg));
imagejpeg($thumbImg,"$save",100);
echo "done!";
}else{
echo "could not do picture";
}
}

Link to comment
https://forums.phpfreaks.com/topic/54016-how-to-install-gd/#findComment-267065
Share on other sites

upLoadPicture($galleryid,$picture,$descrive,$save,$width){
$srcImg=imagecreatefromjpeg($picture);
$widthx=imagesx($srcImg);
$heighty=imagesy($srcImg);

if($widthx>600){
$ratio=$widthx/$width;
$thumbHeight=$heighty*$ratio;
$thumbImg=imagecreate($Width,$thumbHeight);
imagecopyresized($thumbImg,$srcImg,0,0,0,0,$Width,$thumbHeight,imagesx($thumbImg),imagesy($thumbImg));
imagejpeg($thumbImg,"$save",100);
echo "done!";
}else{
echo "could not do picture";
}
}

 

I think that is it.

 

www.php.net/imagecreate

www.php.net/imagecreatefromjpeg

 

They both return an image resource which in return is used for the imagesx and y function

 

Link to comment
https://forums.phpfreaks.com/topic/54016-how-to-install-gd/#findComment-267076
Share on other sites

yeah i just notice that but I'm train to get the image width and height and i think I'm doing something wrong because nothing works.

 

if(isset($_POST['Upload'])){
$save='/image';
$galleryid=$_POST['galleries'];
$picture=$_POST['fileField'];
$descrive=$_POST['textfield'];
//upLoadPicture($galleryid,$picture,$descrive,$save,600);
$a=getimagesize($picture);
$width = $a[0];
$height = $a[1];
echo $width.$height;
}

Link to comment
https://forums.phpfreaks.com/topic/54016-how-to-install-gd/#findComment-267091
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.