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