How to get original image properties

See all posts Reply

How to get original image properties new!
by Janno, 17 years, 5 months ago
I want to know original image parameters, but
$width = $handle->image_src_x;
$height = $handle->image_src_y;
won't help me.Reply
Re: How to get original image properties new!
by colin, 17 years, 5 months ago
At which stage do you read these? You can only read these values after calling process().

In the next release, it will be possible to read these values before calling process().Reply
Re: How to get original image properties new!
by Janno, 17 years, 4 months ago
I use script like this:
if ($handle->uploaded) {
  $handle->file_new_name_body = 'mypic';
  $handle->file_max_size = '10857640';
  $handle->process($originaldir);
  if ($handle->processed) {
    mysql_query("INSERT INTO images SET 
      ImageSourceName='$newname.".$handle->file_src_name_ext."',
      ImageName='".$handle->file_src_name."',
      OriginalSize='".$handle->file_src_size."',
      OriginalWidth='".$handle->image_src_x."',
      OriginalHeight='".$handle->image_src_y.""); 
  } 
  $handle-> clean();
}

but in database 'OriginalWidth' and 'OriginalHeight' values are zero.Reply
Re: How to get original image properties new!
by colin, 17 years, 4 months ago
This is normal, since the image is not manipulated (resized, etc..) so the file is treated like any other file, and not like an image.

However, this feature will be available in the next version, soon to be released.Reply
Re: How to get original image properties new!
by Janno, 17 years, 4 months ago
solution for that problem is simple.If tempfile is uploaded, then that class don't understand file type(because tempfile don't have extention) and then works only simple file manipulation function like copy and delete, buf if file is first time processed then new file have extention. then all functions works fine.Reply