anf.etienne Posted March 7, 2009 Share Posted March 7, 2009 is it possible to get a image that has already been uploaded resized? Quote Link to comment https://forums.phpfreaks.com/topic/148370-solved-resize-image/ Share on other sites More sharing options...
GingerRobot Posted March 7, 2009 Share Posted March 7, 2009 Yes. Load it with the appropriate version of imagecreatefrom(gif/jpeg/png/etc) and use the imagecopyresampled function Quote Link to comment https://forums.phpfreaks.com/topic/148370-solved-resize-image/#findComment-778941 Share on other sites More sharing options...
anf.etienne Posted March 7, 2009 Author Share Posted March 7, 2009 can this replace the original file? Quote Link to comment https://forums.phpfreaks.com/topic/148370-solved-resize-image/#findComment-778942 Share on other sites More sharing options...
anf.etienne Posted March 7, 2009 Author Share Posted March 7, 2009 im a php noob so can you give me an example of how its done and i can work my way from there? Quote Link to comment https://forums.phpfreaks.com/topic/148370-solved-resize-image/#findComment-778945 Share on other sites More sharing options...
redarrow Posted March 7, 2009 Share Posted March 7, 2009 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; ?> Quote Link to comment https://forums.phpfreaks.com/topic/148370-solved-resize-image/#findComment-778947 Share on other sites More sharing options...
anf.etienne Posted March 7, 2009 Author Share Posted March 7, 2009 will this work if i take out the thumbnails as its not needed? Quote Link to comment https://forums.phpfreaks.com/topic/148370-solved-resize-image/#findComment-778954 Share on other sites More sharing options...
redarrow Posted March 7, 2009 Share Posted March 7, 2009 try the example, like i say it a example need to learn gd, sorry no support from the code provided, as it from Google. Quote Link to comment https://forums.phpfreaks.com/topic/148370-solved-resize-image/#findComment-778955 Share on other sites More sharing options...
anf.etienne Posted March 7, 2009 Author Share Posted March 7, 2009 i've seen a lot of PHP GD examples......hmmm.....ill try but im after something simpler...GD is too much to tae in right now lol thanks for the example i will try it out Quote Link to comment https://forums.phpfreaks.com/topic/148370-solved-resize-image/#findComment-778965 Share on other sites More sharing options...
redarrow Posted March 7, 2009 Share Posted March 7, 2009 Read this shows you how to upload and re size a image. just for now. http://blazonry.com/scripting/upload-size.php Quote Link to comment https://forums.phpfreaks.com/topic/148370-solved-resize-image/#findComment-778968 Share on other sites More sharing options...
anf.etienne Posted March 7, 2009 Author Share Posted March 7, 2009 thanks red arrow Quote Link to comment https://forums.phpfreaks.com/topic/148370-solved-resize-image/#findComment-778979 Share on other sites More sharing options...
anf.etienne Posted March 7, 2009 Author Share Posted March 7, 2009 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/"; } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/148370-solved-resize-image/#findComment-779006 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.