Articles of add image size

add_image_size() cropped only if width of the image matches or is higher

I want to add a custom image size that is cropped, like this: add_image_size( ‘large-cropped’, 700, 300, true ); It works fine. The only problem is that if the image size is for example 500×400, then it will create an image that is 500×300. I only want it to create an image if the width […]

WordPress won't generate image sizes for certain images

I have no idea why this particular image and others seem to be affected, but it’s really annoying. I have noticed, there is one image in particular that WordPress just will not generate different images for. I tested another image, and different sizes were created just fine. Went back to the original image, and even […]

WordPress not cropping thumbnails properly

For some reason WordPress is ignoring my thumbnail sizes and keeping thumbnails cropped proportionately instead of specific dimensions. Here is what I have in my functions.php: add_image_size(‘main-thumbnail’, 728, 410, true); and I have this in my content.php: <div class=”thumbnail”><a href=”<?php the_permalink(); ?>”> <?php the_post_thumbnail(‘main-thumbnail’); ?></a></div> I added these two things and regenerated my images with […]

Define WordPress image size in img tag

Is there a way to output a image in a pre-determined size (Ie; using add_image_size) using just the img tag? For example, how can I make sure that the image that is echoed using this tag is the exact size I determined in functions.php under ‘slider’ <img src=”<?php echo of_get_option(‘slideshow_1’);?>” alt=”#”/> I hope that made […]

WordPress Image Editor doesn't update thumbs specified with `add_image_size()`

The title somewhat explains the issue. I have a template using bones. I am not sure if this matters or not. Bones – An HTML5, Mobile-First starter theme for rapid WordPress development. In the functions.php file we add some additional thumbnail size options: add_image_size( ‘bones-thumb-400’, 400, 300, true ); add_image_size( ‘bones-thumb-300’, 300, 230, true ); […]

add_image_size creating lots of images (of various sizes)

I wonder if its a good idea to use add_image_size or is it just a convinence feature. I say this as I think add_image_size creates images of various sizes regardless of what the usage if the image maybe eg. I may want a thumbnail of 500×200 in my portfolio pages only. but WordPress will create […]

add_image_sizes ignoring crop sizes and using proportion

Before we start, the image is definitely big enough. I have an image that is 2206 x 2042 and I wish to crop (not scale) it in a number of different ways to be used responsively. The sizes I am trying to produce are: add_image_size( ‘artist-full-xs’, 730, 1842, array(‘right’, ‘bottom’) ); add_image_size( ‘artist-full-xs-sm’, 730, 1000, […]

set_post_thumbnail_size in percent, not pixels?

I’ve created a new custom post type and I need the post thumbnails or featured images generated by the get_the_post_thumbnail() function to be set in percent, rather than pixels, as I’m using a fluid grid. Ideally I would only set the width (to 100%). Is there a way to do this? Potentially using add_image_size()?

How to prevent upload of a multiple sizes of images

on my theme, i found this script add_image_size( ‘slider’, 464, 249, true ); add_image_size( ‘fmenu’, 306, 280, true ); add_image_size( ‘teamthumb’, 138, 207, true ); add_image_size( ‘imlink’, 286, 140, true ); add_image_size( ‘albmlink’, 274, 274, true ); add_image_size( ‘fppost’, 90, 90, true ); add_image_size( ‘fslide’, 520, 280, true ); i have disabled this, but when […]

How to create thumbnails with a fixed width, so all of them will have the same width?

right now, a thumbnail will be either 150px in height or in width, depending if it’s landscape or portrait. Is there a way to make them always the same width and scale them in height accordingly, without squaring them? Kind regards