class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
hi i try to take thumb image from original image i want to take thum and keep the original image the code used
$foo = new Upload($_FILES['mhna_pic']);
$fooThumb=$foo;
$fooThumb->file_new_name_body="image_resized";
$fooThumb->image_resize=true;
$fooThumb->image_convert=gif;
$fooThumb->image_x=90;
$fooThumb->image_y=105;
$foo2 = new Upload($_FILES['mhna_pic2']);
if ($foo or $foo2 or $fooThumb->uploaded) {
$foo->Process('ups/');
$fooThumb->Process('ups/');
$foo2->Process('ups/');
if ($foo or $foo2 or $fooThumb->processed) {
$namei=$foo->file_dst_name;
$nameiThumb=$fooThumb->file_dst_name;
as you see i use $nameiThumb to take copy from $foo this code work successfully in crop image but when store in name in database not work but save $foo name instead $nameiThumb plz help me how to save $nameiThumb
Do not copy your object $foo. You have two sources images, so you can instantiate the class twice. For the first instance, you process two images. For the second instance, you process one image.
You should have something like this:
$foo = new Upload($_FILES['mhna_pic']);
$foo2 = new Upload($_FILES['mhna_pic2']);
if ($foo->uploaded && $foo2->uploaded) {
// save main image
$foo->Process('ups/');
$first = $foo->file_dst_name;
// make thumbnail
$foo->file_new_name_body="image_resized";
$foo->image_resize=true;
$foo->image_convert=gif;
$foo->image_x=90;
$foo->image_y=105;
$foo->Process('ups/');
$thumb = $foo->file_dst_name;
// save second image
$foo2->Process('ups/');
$second = $foo2->file_dst_name;
if ($foo->processed && $foo2->processed) {
// save your image names here: $first, $thumb, $second
}
}
hi thx for yu rreplay, but in this way save the same name (image_resized) for $foo and $thumb i want to $foo (stay the same name take by the class). $thumb (new resized name)Reply
Re: problem in create thumb from image and save in database new!
i try to take thumb image from original image
i want to take thum and keep the original image
the code used
as you see i use $nameiThumb to take copy from $foo this code work successfully in crop image but when store in name in database not work but save $foo name instead $nameiThumb
plz help me how to save $nameiThumb
You should have something like this:
thx for yu rreplay, but in this way save the same name (image_resized) for $foo and $thumb
i want to
$foo (stay the same name take by the class).
$thumb (new resized name)