There is a form through which people upload images to the site. The script checks if it is a picture or not, if it is a picture, it saves it and outputs it to the browser. How to make so that when loading through a form the picture is cropped to the size of 100 by 100 pixels? So far, Google hasnβt found anything in Google.
Here is the actual PHP code:
if(isset($_FILES['filename']['name'])) { $name = $_FILES['filename']['name']; $typeok = TRUE; #### #$name = strtolower(ereg_replace("[^A-Za-z0-9.]", "", $name); //Π‘ΠΊΡΠΈΠΏΡ ΠΏΠ΅ΡΠ΅ΡΡΠ°Π΅Ρ ΡΠ°Π±ΠΎΡΠ°ΡΡ, Π΅ΡΠ»ΠΈ ΡΠ°ΡΠΊΠΎΠΌΠΌΠ΅Π½ΡΠΈΡΠΎΠ²Π°ΡΡ ΡΡΡ ΡΡΡΠΎΡΠΊΡ(( switch($_FILES['filename']['type']) { case 'image/jpeg': $ext = 'jpg'; break; case 'image/pjpeg': $ext = 'jpg'; break; case 'image/gif': $ext = 'gif'; break; case 'image/png': $ext = 'png'; break; case 'image/tiff': $ext = 'tif'; break; default: $typeok = FALSE; break; } if($ext) { $n = strtolower("$name"); move_uploaded_file($_FILES['filename']['tmp_name'], "images/users/$n"); echo("<div class=\"alert alert-success\">"); echo("<p>ΠΠ°Π³ΡΡΠΆΠ΅Π½ΠΎ ΠΈΠ·ΠΎΠ±ΡΠ°ΠΆΠ΅Π½ΠΈΠ΅ $name ΠΏΠΎΠ΄ ΠΈΠΌΠ΅Π½Π΅ΠΌ $n: </p><br>"); echo("<img src='images/users/$n'>"); echo("</div>"); } else { echo("<div class=\"alert alert-error\">"); echo ("<p>'$name' - Π½Π΅ΠΏΡΠΈΠ΅ΠΌΠ»ΠΈΠΌΡΠΉ ΡΠ°ΠΉΠ» ΠΈΠ·ΠΎΠ±ΡΠ°ΠΆΠ΅Π½ΠΈΡ</p>"); echo("</div>"); } } else { echo("<div class=\"alert alert-error\">"); echo ("<p>ΠΠ°Π³ΡΡΠ·ΠΊΠΈ ΠΈΠ·ΠΎΠ±ΡΠ°ΠΆΠ΅Π½ΠΈΡ Π½Π΅ ΠΏΡΠΎΠΈΠ·ΠΎΡΠ»ΠΎ!</p>"); echo("</div>"); }