Claim your freedom to choose the perfect partner for your multi-vendor journey.

FREEDOM25

Celebrate the festive season by giving your marketplace a powerful lift!

FESTIVE20

5.0.0
Something big is coming for marketplace admins… MultiVendorX 5.0 is almost here. Are you ready?
Be the first to explore all the game-changing features!
Power your marketplace dreams with unbeatable Black Friday deals!

MVXBLACK30

Supercharge your marketplace vision with unstoppable Cyber Monday deals!

MVXCYBER30

Holiday cheer, bigger savings
Take 25% off-because your marketplace deserves a gift too.

happyholiday

View Categories

Restrict image ratio when Vendors upload their product images

You need to add the below code in the functions.php file of your current active theme –

function resize_resolution($file) {
$image = getimagesize($file[‘tmp_name’]);
$minimum = array(
‘width’ => ‘400’, //set your minimum
‘height’ => ‘400’
);
$maximum = array(
‘width’ => ‘2000’, //set your maximum
‘height’ => ‘2000’
);
$image_width = $image[0];
$image_height = $image[1];

$too_small = “Image dimensions are too small.”;
$too_large = “Image dimensions are too large.”;

if ( $image_width < $minimum[‘width’] || $image_height < $minimum[‘height’] ) {
$file[‘error’] = $too_small;
return $file;
}
elseif ( $image_width > $maximum[‘width’] || $image_height > $maximum[‘height’] ) {
$file[‘error’] = $too_large;
return $file;
}
else
return $file;
}
add_filter(‘wp_handle_upload_prefilter’, ‘resize_resolution’);

Leave a Reply

Shopping Cart
Scroll to Top