Jump to content

DIMENSION RESTRICTIONS USING "imagecopyresized"


dlebowski

Recommended Posts

Below is my image upload and resize script.  The issue I am running into is when an image is wider than 800px (i'm not even sure how much wider, i just know that an image that is 800px wide will upload, but larger ones won't).  Anyway, is there a "dimension limit" on images when using "imagecopyresized"?  Thank you for your time?

 

$uploaddir3 = "/my/server/path/coname/images/";
$thumbDirectory3 = "/my/server/path/test";
$thumbWidth3 = "640";

$target_encoding3 = "ISO-8859-1";
echo '<pre>';
if(count($_FILES) > 0)
{
$arrfile3 = pos($_FILES);
$uploadfile3 = $uploaddir3 . iconv("UTF-8", $target_encoding3,basename(strtoupper($arrfile3['name'])));

if (move_uploaded_file($arrfile3['tmp_name'], $uploadfile3))
	echo "File is valid, and was successfully uploaded.\n";

$imageName3 = basename(strtoupper($arrfile3['name']));

function createThumbnail3($uploaddir3, $imageName3, $thumbDirectory3, $thumbWidth3)
{
$srcImg3 = imagecreatefromjpeg("$uploaddir3/$imageName3");
$origWidth3 = imagesx($srcImg3);
$origHeight3 = imagesy($srcImg3);

$ratio3 = $thumbWidth3 / $origWidth3;
$thumbHeight3 = $origHeight3 * $ratio3;

$thumbImg3 = imagecreatetruecolor($thumbWidth3, $thumbHeight3);
imagecopyresized($thumbImg3, $srcImg3, 0, 0, 0, 0, $thumbWidth3, $thumbHeight3, $origWidth3, $origHeight3);

imagejpeg($thumbImg3, "$thumbDirectory3/$imageName3");
}

createThumbnail3("/my/server/path", "$imageName3", "/my/server/path/coname/images/test", $thumbWidth3);


}
else
{


}

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.