Problem with image_dst_x and image_dst_y

See all posts Reply

Problem with image_dst_x and image_dst_y new!
by Erdem, 14 years, 3 months ago
Hi Colin,
After upgrading from 0.25 to 0.28 I can't get image_dst_x and image_dst_y variables. It returns 0 for both.

My code:
$U = new upload($file);
$U->allowed = array("image/*");
$U->file_new_name_body =substr(md5(uniqid(rand(), true)),0,16);
if($resize) {
  $U->image_resize  = true;
  $U->image_ratio_crop = true;
  $U->image_x = $width;
  $U->image_y = $height;
  $U->image_ratio_no_zoom_in = true;
}
$U->file_overwrite = false;
$U->file_auto_rename = true;
$U->process($uploaddir);
if ($U->processed) {
  $width = $U->image_dst_x;
  $height = $U->image_dst_y;
  $name = $U->file_dst_name;
  $U->file_new_name_body = $U->file_dst_name_body.'_100x100';
  $U->image_resize  = true;
  $U->image_ratio_crop = true;
  $U->image_x = 100;
  $U->image_y = 100;
  $U->image_ratio_no_zoom_in = true;
  $U->process($uploaddir);
  if($U->processed) {
    // more stuff
Reply
Re: Problem with image_dst_x and image_dst_y new!
by colin, 14 years, 3 months ago
Can you copy here the complete log produced by the class?Reply
Re: Problem with image_dst_x and image_dst_y new!
by Erdem, 14 years, 3 months ago
Thanks for quick reply. Here is the log:
system information
- class version : 0.28
- GD version : 2.0
- supported image types : png jpg gif bmp
- open_basedir : no restriction
- language : en_GB
source is an uploaded file
- upload OK
- file name OK
determining MIME type
- Checking MIME type with Fileinfo PECL extension
Fileinfo PECL extension not available
- Checking MIME type with UNIX file() command
MIME returned as image/jpeg
MIME type detected as image/jpeg by UNIX file() command
source variables
- You can use all these before calling process()
file_src_name : t1larg.soda.fountain.cnn.jpg
file_src_name_body : t1larg.soda.fountain.cnn
file_src_name_ext : jpg
file_src_pathname : /tmp/phpFkjDNA
file_src_mime : image/jpeg
file_src_size : 44574 (max= 2097152)
file_src_error : 0
- source file is an image
image_src_x : 640
image_src_y : 360
image_src_pixels : 230400
image_src_type : jpg
image_src_bits : 8
process file to /home/redrain/www/gg/images/posts/012010/
- file size OK
- file mime OK : image/jpeg
- new file name body : gg_17f5c45fd3576fb5
- file name safe format
- destination variables
file_dst_path : /home/redrain/www/gg/images/posts/012010/
file_dst_name_body : gg_17f5c45fd3576fb5
file_dst_name_ext : jpg
- no image operation, keep extension
- checking for auto_rename
- destination file details
file_dst_name : gg_17f5c45fd3576fb5.jpg
file_dst_pathname : /home/redrain/www/gg/images/posts/012010/gg_17f5c45fd3576fb5.jpg
- gg_17f5c45fd3576fb5.jpg doesn't exist already
- no image processing wanted
- process OK
Reply
Re: Problem with image_dst_x and image_dst_y new!
by colin, 14 years, 3 months ago
I think that image_dst_x and image_dst_y are not populated because the image is not resized, or otherwise graphically manipulated (no image processing wanted).

In this case, image_dst_x and image_dst_y are equal to image_src_x and image_src_y. I will fix it for the next version.Reply
Re: Problem with image_dst_x and image_dst_y new!
by Erdem, 14 years, 3 months ago
Yes, that's the problem.

Thanks again.Reply