I have an image that is being uploaded then converted to a thumbnail,
how can I choose the name of the file(by choose I meant a variable based on some mysql things) I edit into a thumbnail then move it to a folder in the root of my website?
This is the
PHP that opens the file then edits it to 200pcx200px
- PHP: Select all
$image = $img->openImage($_FILES['uploadfile']['tmp_name']);
if ($image === false) { die ('Unable to open image'); }
// Get original width and height
$width = imagesx($image);
$height = imagesy($image);
// New width and height
$new_width = 200;
$new_height = 200;
// Resample
$image_resized = imagecreatetruecolor($new_width, $new_height);
imagecopyresampled($image_resized, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);