I am currently wondering what is the best way to let the user choose between a certain number of thumbnail size for the shortcodes I am building.

add_image_size function is the simplest way but adding 10 size of thumbnail to the theme will create a enormous number of unneeded thumbnails.

I really want to avoid this, is there any good way to do this?

  • Maybe just give an option to select image size in shortcode and on save_post hook your function to create the selected image size for the attachment. Unless you want to show the thumbnails while the user makes a choice. – sven Sep 14 '17 at 5:57
  • Add function could I use to create the selected image size for the attachement? Using wp_get_attachment_image with an array instead of a thumbnail size, how would wordpress manage the image in this case? – Lucas Selsek Sep 15 '17 at 6:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.