Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<pre><code>&lt;form action="&lt;?php echo $_server['php-self']; ?&gt;" method="post" enctype="multipart/form-data" id="something" class="uniForm"&gt; &lt;input name="new_image" id="new_image" size="30" type="file" class="fileUpload" /&gt; &lt;button name="submit" type="submit" class="submitButton"&gt;Upload Image&lt;/button&gt; &lt;/form&gt; &lt;?php if(isset($_POST['submit'])){ if (isset ($_FILES['new_image'])){ $imagename = $_FILES['new_image']['name']; $source = $_FILES['new_image']['tmp_name']; $target = "./temp/".$imagename; move_uploaded_file($source, $target); $imagepath = $imagename; $save = "./temp/" . $imagepath; //This is the new file you saving $file = "./temp/" . $imagepath; //This is the original file list($width, $height) = getimagesize($file) ; $modwidth = 500; $diff = $width / $modwidth; $modheight = $height / $diff; $tn = imagecreatetruecolor($modwidth, $modheight) ; $image = imagecreatefromjpeg($file) ; imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ; imagejpeg($tn, $save, 100) ; $i=123; $j='.jpg'; $save = "./images/".$i .$imagepath; //This is the new file you saving $file = "./temp/" . $imagepath; //This is the original file list($width, $height) = getimagesize($file) ; $modwidth = 160; $diff = $width / $modwidth; $modheight = $height / $diff; $tn = imagecreatetruecolor($modwidth, $modheight) ; $image = imagecreatefromjpeg($file) ; imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ; imagejpeg($tn, $save, 100) ; unlink($target); //Delete our uploaded file echo "Large image: &lt;img src='./temp/".$imagepath."'&gt;&lt;br&gt;"; echo "Small image: &lt;img src='./images/".$i .$imagepath; echo"'&gt;"; echo " &lt;br&gt; Large image path: './temp/".$imagepath; echo " &lt;br&gt; Small image path: './images/".$i .$imagepath; } } ?&gt; </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