0

This question already has an answer here:

How can I require specific dimensions for an image for an upload form? For example, I want to set the image to be uploaded in 350x200px, or show a notice to the user if the image size is not correct.

Alternatively, can I set a minimum upload size?

marked as duplicate by Nicolai, Brad Dalton, Howdy_McGee, TheDeadMedic, Mark Kaplun Jul 19 '15 at 0:33

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0

Add these code to your theme function file.

add_image_size('mythumb', 350, 200, array( 'left', 'top' ));
// third parameter is for cropped option, you can change that as your preference.
the_post_thumbnail( 'mythumb' );// image with the new dimensions.

Important: you need to regenerate thumbnails to make this work. You can use plugin for that. For complete study, check official guide: https://codex.wordpress.org/Function_Reference/add_image_size

  • Hi, I'm using dokan plugin, will this work? – pryde1919 Jul 12 '15 at 14:56
  • My answer is wrong for your requirement, Please follow the possible duplicate link to get the solution specific to your requirement. – Rituparna sonowal Jul 12 '15 at 18:18
  • Can I use a javascript inside the php? may I ask the script? – pryde1919 Jul 13 '15 at 12:31
  • Yes you can. <?php //your php code. ?><script> Your javaScript code. </script><?php //your php code ?> – Rituparna sonowal Jul 13 '15 at 12:50

Not the answer you're looking for? Browse other questions tagged or ask your own question.