Jump to content

[SOLVED] resize image


anf.etienne

Recommended Posts

Quick example only.

<?php
$imagefile=$imgdir.$filename;
if(file_exists($imagefile)){
$imgpat=”(jpg|jpeg|gif|png|wbmp){1}$”;
if(eregi($imgpat,$mime,$ires) && $thumb>0){
$image=loadImage($imagefile,$ires[1]);

// Output
$imgfun=”image”.$ires[1];
$thumbfile=”img/thumb/”.$thumb.”_”.$filename;
if($imgfun($image,$thumbfile)){
imagedestroy($image);
header(”Content-Length: “.filesize($thumbfile));
header(”Content-type: “.$mime);
readfile($thumbfile);
exit;
}
} else {
header(”Content-Length: “.filesize($imagefile));
header(”Content-type: “.$mime);
readfile($imagefile);
exit;
}
} else{
header(”HTTP/1.0 404 Not Found”);
exit;
}
} else{
header(”HTTP/1.0 404 Not Found”);
exit;
?>

Link to comment
https://forums.phpfreaks.com/topic/148370-solved-resize-image/#findComment-778947
Share on other sites

it luks lyk im gonna have to use the resize on upload. that last link you sent wasn't to helpful....how can i change this upload code to include the resizing?

 

<?
while(list($key,$value) = each($_FILES['images']['name']))
	{
		if(!empty($value))
		{
			$filename = $value;
				$filename=str_replace(" ","_",$filename);// Add _ inplace of blank space in file name, you can remove this line

				$add = "upload/imgtemp/m/$random_digit/$filename";
				$tempFLDR = "upload/imgtemp/t/$random_digit/$filename";
                       //echo $_FILES['images']['type'][$key];
		     // echo "<br>";
				copy($_FILES['images']['tmp_name'][$key], $add);
				chmod("$add",0777);
				copy($_FILES['images']['tmp_name'][$key], $tempFLDR);
				chmod("$tempFLDR",0777);

$folderPath="upload/$random_digit/";
		}
	}
?>

Link to comment
https://forums.phpfreaks.com/topic/148370-solved-resize-image/#findComment-779006
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.