problem in create thumb from image and save in database

See all posts See thread Reply

Re: problem in create thumb from image and save in database new!
by colin, 11 years ago
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
  }
}
Reply
Re: problem in create thumb from image and save in database new!
by Ethar, 11 years ago
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!
by Ethar, 11 years ago
no no its work successfully thxReply
Re: problem in create thumb from image and save in database new!
by colin, 11 years ago
The names are different, as file_new_name_body is used only fo rthe thumbnail. Use file_new_name_body in other places if you need to.Reply
Re: problem in create thumb from image and save in database new!
by Ethar, 11 years ago
thxxxxxxxxxxxxxxxxxxxxxx for you its work successfullyReply