Resize in percentage

See all posts Reply

Resize in percentage new!
by Gawith, 15 years, 6 months ago
How can i set my resize in percentage 25%, 50% etc. from orginal size ?Reply
Re: Resize in percentage new!
by colin, 15 years, 6 months ago
I may implement such a feature in a future release. In the meantime, you can simply read image_src_x and image_src_y before calling process(), and act accordingly. For instance:

$handle = new Upload($_FILES['xxxx']);
if ($handle->uploaded) {
    $handle->image_convert = 'jpg';
    $handle->image_resize = true;
    $handle->image_ratio = true;
    $handle->image_x = $handle->image_src_x / 2; // 50%
    $handle->image_y = $handle->image_src_y / 2; // 50%
    $handle->Process("images/");
    $handle->Clean();
}
Reply