Why cropping does not work

See all posts Reply

Why cropping does not work new!
by Ivan, 6 months, 3 weeks ago
Greetings. I can’t figure out why cropping does not work with this code, where the coordinates of TRBL are transmitted. It is either not what is needed or something is cut out, depending on the position of the selected area in the image.

$handle = new upload(WAY . '/files/covers/' . $msg['filename'], 'ru_RU');
if ($handle->uploaded) {
    $handle->file_new_name_body = 'cover-' . $cover['url'];
    $handle->file_overwrite = true;
    $handle->image_precrop = array($msg['t'], $msg['r'], $msg['b'], $msg['l']);
    $handle->image_resize = true;
    $handle->image_ratio_crop = true;
    $handle->image_x = 300;
    $handle->image_y = 400;
    $handle->image_convert = 'jpg';
    $handle->jpeg_quality = 80;
    $handle->process(WAY . 'files/covers/');
    if ($handle->processed) {  
        $msg['cover'] = str_replace('\\', '', $handle->file_dst_pathname) . '?r=' . rand(0000, 99999);
        $handle->clean();
        $msg['status'] = TRUE;
    } else {
        $msg['errors']['cover'] = $handle->error;
    }
}

I will be glad to any tipsReply
Re: Why cropping does not work new!
by colin, 6 months, 3 weeks ago
I am not sure why it doesn't crop, but you can get more information in the log produced by the class.Reply
Re: Why cropping does not work new!
by Ivan, 6 months, 3 weeks ago
system information
- class version : 0.35dev
- operating system : WINNT
- PHP version : 5.6.19
- GD version : 2.1.0
- supported image types : png jpg gif bmp
- open_basedir : d:/openserver/domains;d:/openserver/userdata/temp;d:/openserver/modules/system/html/openserver;d:/openserver/modules/php/PHP-5.6
- upload_max_filesize : 100M (104857600 bytes)
- language : ru_RU
source is a local file ..//files/covers/20150322182409.jpg
- local file OK
determining MIME type
- Checking MIME type with Fileinfo PECL extension
MAGIC path defaults to D:\OpenServer\modules\php\PHP-5.6/extras/magic
Fileinfo PECL extension failed (finfo_open)
- Checking MIME type with UNIX file() command
UNIX file() command not availabled
- Checking MIME type with mime.magic file (mime_content_type())
MIME type detected as image/jpeg by mime_content_type()
- MIME validated as image/jpeg
source variables
- You can use all these before calling process()
file_src_name : 20150322182409.jpg
file_src_name_body : 20150322182409
file_src_name_ext : jpg
file_src_pathname : ..//files/covers/20150322182409.jpg
file_src_mime : image/jpeg
file_src_size : 34446 (max= 104857600)
file_src_error : 0
- source file is an image
image_src_x : 640
image_src_y : 480
image_src_pixels : 307200
image_src_type : jpg
image_src_bits : 8
process file to ../files/covers/\
- file size OK
- file mime OK : image/jpeg
- new file name ext : jpg
- new file name body : cover-else-one
- file name safe format
- destination variables
file_dst_path : ../files/covers/\
file_dst_name_body : cover-else-one
file_dst_name_ext : jpg
- no auto_rename if same filename exists
- destination file details
file_dst_name : cover-else-one.jpg
file_dst_pathname : ../files/covers/\cover-else-one.jpg
- no overwrite checking
- EXIF data is invalid or missing
- image resizing or conversion wanted
- source image is JPEG
- pre-crop image : 211 480 521 67
- resizing...
ratio_crop_x : 36900 (18450;18450)
image_src_x y : 93 x 1
image_dst_x y : 37200 x 400
resized image object created
- crop image : 0 18450 0 18450
- converting...
fills in transparency with default color
- saving image...
JPEG image created
image objects destroyed
- process OK
cleanup
- delete temp file ..//files/covers/20150322182409.jpg


I didn’t see anything unusual with my eyesReply