Tag Info

New answers tagged


Solving the problem globally and perfectly for ALL image files (and links) in a large site - given the possibility, for instance, that individuals may have occasionally renamed image files manually imitating the WP style - and other odd variations - might be difficult. Database search and replace operations are also going involve complications (and risks!). ...


why didn't use add_image_size( 'horizontal_img', 800, 300, true ); add_image_size( 'vertical_img', 300, 800, true ); And then $image_hor = wp_get_attachment_image_src($post_id,'horizontal_img'); $image_ver = wp_get_attachment_image_src($post_id,'vertical_img'); when echo $image_hor[0] you will get your desire sized image url. Thanks Musa


If you are using wordpress, this guide might help you - https://developer.wordpress.org/reference/functions/add_image_size/

Top 50 recent answers are included