View Single Post
  #1 (permalink)  
Old Nov 8th, 2007, 17:29
alexgeek's Avatar
alexgeek alexgeek is offline
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,803
Blog Entries: 9
Thanks: 2
Thanked 2 Times in 2 Posts
[SOLVED] Edit image then move it?

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$image0000$new_width$new_height$width$height); 
Reply With Quote