Up to 50 percent off

Minimum image size

This topic contains 8 reply and 3 voices, and was last updated by Nayem 9 years, 5 months ago
Viewing 8 Posts - 1 through 8 (of 8 total)
Author Posts
March 25, 2015 at 8:20 pm 40018
Nayem Hi, Is it possible to add a minimum image size in some way? I have found that some of my users are uploading images that are far too small and I would love to stop that. I found the following code online, that does work with the Media Library, but doesn't seem to work with WPUF. What happens is the image does not upload, but there are no messages to state why which means users would not know why their images are not uploading.
add_filter('wp_handle_upload_prefilter','tc_handle_upload_prefilter');
function tc_handle_upload_prefilter($file)
{

    $img=getimagesize($file['tmp_name']);
    $minimum = array('width' => '640', 'height' => '480');
    $width= $img[0];
    $height =$img[1];

    if ($width < $minimum['width'] )
        return array("error"=>"Image dimensions are too small. Minimum width is {$minimum['width']}px. Uploaded image width is $width px");

    elseif ($height <  $minimum['height'])
        return array("error"=>"Image dimensions are too small. Minimum height is {$minimum['height']}px. Uploaded image height is $height px");
    else
        return $file; 
}
I hope you can help. Damien
March 26, 2015 at 9:33 pm 40061
Nayem Nayem

Hello Damien,

I have to discuss with our developer team about this. But it is now holiday here. They will be available from sunday. Please keep patience.

Thank you 🙂

March 26, 2015 at 10:09 pm 40076
hatchmedia hatchmedia

Thanks Nayem for checking with them. I will follow up with you Sunday.

Damien

March 29, 2015 at 12:22 pm 40230
Nayem Nayem

Hello,

Actually we will work for this minimum and maximum size. We are planning to create an option in backend for the image height and weight. Right now we are managing image size with plupload. We will add and option to select image size there.

Thank you 🙂

March 30, 2015 at 1:38 pm 40273
hatchmedia hatchmedia

Hi Nayem,

Thanks for the update, this is great to hear.

Do you have any idea of when that might be?

Thanks again.

Damien

March 30, 2015 at 1:48 pm 40274
Nayem Nayem

Hello,

I can not make you sure about the date. But we will implement this feature in near future release.

March 30, 2015 at 4:51 pm 40284
hatchmedia hatchmedia

Thanks Nayem, this is appreciated!

June 7, 2015 at 8:49 pm 46405
Yves Yves

Any update on this?
I badly need this 😉

June 8, 2015 at 11:03 am 46435
Nayem Nayem

Hello Yves,

We are working on some new feature for that reason we were not able to implement this one yet. But this feature request is in our to-do list. We will implement this one as early as possible.

Thanks.

Viewing 8 Posts - 1 through 8 (of 8 total)