Home Forums Plugin Support WP User Frontend Pro Minimum image size

This topic is: not resolved

Tagged: , ,

This topic contains 8 replies, has 3 voices, and was last updated by  Nayem 3 years, 8 months ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #40018

    hatchmedia
    Participant
    Post count: 116

    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

    #40061

    Nayem
    Moderator
    Post count: 6480

    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 ๐Ÿ™‚

    #40076

    hatchmedia
    Participant
    Post count: 116

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

    Damien

    #40230

    Nayem
    Moderator
    Post count: 6480

    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 ๐Ÿ™‚

    #40273

    hatchmedia
    Participant
    Post count: 116

    Hi Nayem,

    Thanks for the update, this is great to hear.

    Do you have any idea of when that might be?

    Thanks again.

    Damien

    #40274

    Nayem
    Moderator
    Post count: 6480

    Hello,

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

    #40284

    hatchmedia
    Participant
    Post count: 116

    Thanks Nayem, this is appreciated!

    #46405

    Yves
    Participant
    Post count: 23

    Any update on this?
    I badly need this ๐Ÿ˜‰

    #46435

    Nayem
    Moderator
    Post count: 6480

    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 9 posts - 1 through 9 (of 9 total)

The topic ‘Minimum image size’ is closed to new replies.