Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

Bug: Auto resize sometimes doesn't work

#915

There's a couple of related issues I found here.

Firstly the fix from #902 Bug: Uploader sometimes upsizes images didn't seem to work for me. I found you can't specify both image_ratio_y = true and image_ratio_no_zoom_in = true. You also need to specify an image_y input as the maximum height for the image otherwise it doesn't seem to work either. This could be set to the same as the maximum width so really it will be a max dimension rather than max width.

The second issue I had only seemed to happen on my production server. The upload class couldn't detect the mime type and because it was using a temporary file there was no extension so it couldn't use that to guess the mime type. To fix this I just moved the uploaded file first so it had an extension on it. My code now looks like:

$tempFile = tempnam(sys_get_temp_dir(), 'exp_upload_') . $_destFile;
move_uploaded_file($_FILES[$_postName]['tmp_name'], $tempFile);
require_once(BASE . 'framework/modules/pixidou/includes/class.upload/class.upload.php');
$handle = new upload($tempFile);
if ($handle->uploaded) {
    $handle->file_new_name_body = $_destFile;
    $handle->file_new_name_ext = '';
    $handle->image_resize = true;
    $handle->image_ratio = true;
    $handle->image_x = $maxwidth;
    $handle->image_y = $maxwidth;
    $handle->image_ratio_no_zoom_in = true;
    $handle->process(BASE . $_destDir);

Reported by Kelvin Lomberg · February 11th, 2013 @ 10:52 PM

State: resolved
Milestone: 2.1.2
Assigned to: dleffler dleffler

Activity

  1. expNinja
    expNinja
    • State changed from new to resolved

    (from [71de9ff6daa400f96d77a3e479b504c5cb56abc7]) Uses a better algorithm to make sure we know the mimetype and only downsize images on upload if requested [#915 Bug: Auto resize sometimes doesn't work state:resolved] https://github.com/exponentcms/exponent-cms/commit/71de9ff6daa400f9...

    February 12th, 2013 @ 02:44 AM

  2. expNinja
    expNinja

    (from [575a05b333694fa748e2c4c76dcd3b76f21ce973]) Uses a better algorithm to make sure we know the mimetype and only downsize images on upload if requested #915 Bug: Auto resize sometimes doesn't work state:resolved https://github.com/exponentcms/exponent-cms/commit/575a05b333694fa7...

    February 12th, 2013 @ 02:53 AM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.