Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.