Jump to content

Recommended Posts

i have created an image upload system for a website it works fine the image are uploaded and resized.  but if an image is uploaded which is bigger than 1000px wide the thumbnail is not created.  the max size defined for the thumbnails is 200*200px.

 

the code i have used to create the new dimensions is this

 

$ratio1=$old_x/$new_w;
	$ratio2=$old_y/$new_h;
	if($ratio1>$ratio2)	{
		$thumb_w=$new_w;
		$thumb_h=$old_y/$ratio1;
	}
	else	{
		$thumb_h=$new_h;
		$thumb_w=$old_x/$ratio2;
	}
$dst_img=ImageCreateTrueColor($thumb_w,$thumb_h);

 

and the code i have used to resize the original image is this

 

imagecopyresampled($dst_img,$src_img,0,0,0,0,$thumb_w,$thumb_h,$old_x,$old_y);

 

i will post the errors shortly.  if i work out why it not doing it i will post the answer.

Link to comment
https://forums.phpfreaks.com/topic/106454-solved-image-upload-problem/
Share on other sites

i didnt post the errors as they will not come back.  typical i got someone else to test it and the errors came up.  they wrote down what they did and on what page and it will not happen for me.  still trying to get them to come back.

 

i will try the time out as it was taking a while for the image to be uploaded due to the size prob.

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.