Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If you want to save the hassle of resizing them all at once, you can have a conditional that checks if its been resized yet to the new size, and then resize it when the image is accessed for the first time.</p> <pre><code> $edit_file = $_edit_id.'_'.basename($_FILES['edit_imagename']['name']); $uploadfile = $orig_uploaddir . $edit_file; if (move_uploaded_file($_FILES['edit_imagename']['tmp_name'], $uploadfile)) { //---resize image to regular and thumbnail-----------------------------------b $src = imagecreatefromjpeg($uploadfile); $image_info=getimagesize($uploadfile); list($width,$height)=$image_info; //---create 400x400 fullsize--------------b $newwidth=400; $newheight=round(($height/$width)*$newwidth); if ($newheight&gt;400) { $newheight=400; $newwidth=round(($width/$height)*$newheight); } $tmp=imagecreatetruecolor($newwidth,$newheight); imagecopyresampled($tmp,$src,0,0,0,0,$newwidth,$newheight,$width,$height); $filename = $uploaddir . $_edit_id.'_400_'.basename($_FILES['edit_imagename']['name']); imagejpeg($tmp,$filename,100); //---create 400x400 fullsize--------------e //---create 200x200 thumbnail--------------b $tn_width=200; $tn_height=round(($height/$width)*$tn_width); if ($tn_height&gt;200) { $tn_height=200; $tn_width=round(($width/$height)*$tn_height); } $tmp=imagecreatetruecolor($tn_width,$tn_height); imagecopyresampled($tmp,$src,0,0,0,0,$tn_width,$tn_height,$width,$height); $filename = $uploaddir . $_edit_id.'_200_'.basename($_FILES['edit_imagename']['name']); imagejpeg($tmp,$filename,100); //---create 200x200 thumbnail--------------e imagedestroy($tmp); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload