Reply to Re: problem in create thumb from image and save in database

Re: problem in create thumb from image and save in database new!
by colin, 10 years, 5 months 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

Your reply

Name *
Email 
Title *
Text *
CAPTCHA image
Enter the code displayed on the image:
Click on the image to generate another one if it is hard to read it. The case is important