Tag Info

New answers tagged


There're no way to achieve what you want in native WordPress way. You have to use both add_image_size() WordPress function and CSS to create resized thumbnail version of an image. @ialocin already explained what add_image_size() does, so not repeating it. First, you need to set a specific width, a very high value for height and set the hard crop mode to ...


If the last parameter $crop is true, then »images will be cropped to the specified dimensions using center positions«, with »(...) an array can specify positioning of the crop area« - this is generally called hard crop. But you have to make sure that the images are big enough to actually crop the size you want in the end. More information is available at the ...


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

Top 50 recent answers are included