anf.etienne Posted March 7, 2009 Share Posted March 7, 2009 is it possible to get a image that has already been uploaded resized? 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 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? 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? 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; ?> 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? 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. 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 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 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 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/"; } } ?> Link to comment https://forums.phpfreaks.com/topic/148370-solved-resize-image/#findComment-779006 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.