Assigning source image's filename to PHP variable

See all posts Reply

Assigning source image's filename to PHP variable new!
by NightMICU, 14 years ago
Greetings,

I am trying to assign the source filename to a PHP variable so that I can add it to a database. I see that file_name_src contains this information but cannot figure out how to assign it. I tried $photo = $handle->file_name_src ; but that did nothing.Reply
Re: Assigning source image's filename to PHP variable new!
by colin, 14 years ago
Can you copy here the log produced by the class?Reply
Re: Assigning source image's filename to PHP variable new!
by NightMICU, 14 years ago
I'm not sure how to do that. Here is the PHP I am trying to get to work...
$handle = new upload($_FILES['photo']);
if ($handle->uploaded) {
  $handle->file_new_name_body   = $filename;
  $handle->file_auto_rename = true;
  $handle->image_resize         = true;
  $handle->image_x              = 400;
  $handle->image_y        = 400;
  $handle->image_ratio          = true;
  $handle->image_convert = 'jpg';
  $handle->jpeg_quality = 95;
  $handle->process('../../../gallery/photos');
  $handle->file_new_name_body   = $filename . "_thumb";
  $handle->file_auto_rename = true;
  $handle->image_resize         = true;
  $handle->image_x              = 120;
  $handle->image_y        = 120;
  $handle->image_ratio          = true;
  $handle->image_convert = 'jpg';
  $handle->jpeg_quality = 95;
  $handle->process('../../../gallery/photos/thumbs');
  if ($handle->processed) {
    $photo = $handle->file_dst_name_body;
    $handle->clean();
    $addPhotoSql = "INSERT INTO images (caption, filename, album) VALUES ('$caption', '$photo', '$albumTitle')";
    $addPhoto = mysql_query($addPhotoSql) or die(mysql_error());
    header('Location: display_album.php?album=' . $url . "#thumbs");
    } else {
      echo 'error : ' . $handle->error;
    }
  }
}
Reply
Re: Assigning source image's filename to PHP variable new!
by colin, 14 years ago
Output $handle->logReply
Re: Assigning source image's filename to PHP variable new!
by Eli, 14 years ago
maybe you can do the samething you did with the links?

session_start()'

$_SESSION ['imgURL'] = $filename . "_thumb";

Hey, instead of the file_new_name_body, use the file_body_name_add = "_thumb"

that will add the _thumb like this file_thumb.jpg

the way you have it will look like this filenamejpg_thumb.jpg

hope this helpsReply