I upload images around 500x500kb (vary slightly as I resize with a percentage). Wordpress is set to create thumbnails at 150x150.
However, I'm getting 'serve scaled images' errors for two file sizes (dimensions added to end of file title) that are begin resized. One is 272 x 148 and the other is 160x160, yet these sizes aren't in Wordpress media settings. I'm guessing they are theme-specific.
But, as these files appear to be created automatically, how do I set it up so that files are created with the dimensions that are obviously needed by my theme.
And, how does my theme know which version to grab?
Thanks!
Adding new image size
You are looking for Wordpress add_image_size function.
Registers a new image size. This means WordPress will create a copy of the image with the specified dimensions when a new image is uploaded.
In your case:
add_image_size('your-custom-size-name', 272, 148, true);
More info on codex: http://codex.wordpress.org/Function_Reference/add_image_size
New image size in theme
Your theme grabs the image size you ask for with the function get_post_image_thumbnail.
get_the_post_thumbnail($post_id, 'your-custom-size-name');
Resizing existing images
If you've already uploaded some images, you may want to adjust them to the new dimensions automatically. There are few plugins that do so, for example Regenerate thumbnails.
Also, you may want to look to all-in-one tutorial on TutsPlus I've found while googling for the plugin.
Related
I'm new to WordPress and working with a site that I've inherited. The site has 2 screenshots on the main page, managed as a Gallery from the Advanced Custom Fields plugin.
Both screenshots are originally 2880x1996 PNG files that clock in at 460 KB each. WordPress generates thumbnails of these screenshots, and at runtime it's serving the 1920x1331 PNG thumbnail... Which is 1.6 MB in size!
Shouldn't the lower resolution image be smaller in size? How do I get WordPress to do a better job with thumbnail generation, or perhaps just disable it for this image?
In the end, I made some code changes to fix this. First was to define a new image size 'original' in my functions.php. I omitted the dimensions which appear to have caused WordPress to serve up the original image and not one of the inefficiently resized images:
add_image_size( 'original', '', '', true );
Next, I updated the theme to reference 'original' as the image size where it was previously referencing 'large'.
To take it further, I also used pngquant to shrink the image sizes. The 460 KB original was reduced down to 242 KB, which seems pretty good for a 2880x1996 image.
I'm using the Divi theme to build a website in WordPress. The problem I'm facing is this:
wrong image
I'm using the gallery module to display a set of pictures in grid mode. But all the images loaded are shown as above. Id like to display the original image instead of the medium one.
original image
WordPress creates some versions of my images but the aspect ratio is different, so this crop effect is applied on my gallery items.
I have tried to set the correct size on medium images from media settings and generated the images again but nothing changed.
Divi theme uses its own functions to generate thumbnails that hard crop original images by default.
Try editing post_thubnails_divi.php file on theme folder using the dimensions that suit you and set the crop value to false.
$crop = apply_filters( 'et_post_thumbnails_crop', false );
hi you can download the Gallery layout and install it in your DIVI theme. it give some layout options for gallery design.
https://www.elegantthemes.com/blog/divi-resources/free-divi-photo-gallery-layout-pack-5-stunning-gallery-page-layouts-in-one-convenient-download
Note : subscribe it and they will send the downloadable link to your email
thanks
I'm using the add_image_size(); along with the_post_thumbnail(); from wordpress in my functions.php BUT I want the existing images to be refreshed automatically without having to remove and upload them again. How's that possible?
There are multiple plugins that allow you to regenerate your thumbnails without having to reupload them.
Some of them are:
https://wordpress.org/plugins/regenerate-thumbnails/
https://wordpress.org/plugins/force-regenerate-thumbnails/
These plugins actually take the currently registered image sizes, and regenerate all of your images with these sizes, automatically. So once you make a change to your existing image sizes, or create a new image size, you should simply use one of these plugins to regenerate your images quickly.
I created a custom post type 'film" and I want to resize it thumbnails to 100x125 px. I uploaded the images in these dimensions, but when I load the page, several images are showed to 86x125.
This is my functions.php
add_theme_support('post-thumbnails';
set_post_thumbnail_size(150, 150, true);
add_image_size('films-thumbnail', 100, 125, true);
And in my archive-films.php I wrote:
the_post_thumbnail('films-thumbnail');
But I say doesnt work for all images, I dont know if its for wordpress error or for markup error.
This is the list. http://goo.gl/Y3LFCq
Thanks in advance.
Download and install Force Regenerate Thumbnails. This properly resize all your thumbnails to the sizes set. It will also delete sizes that is not used in the theme. Another option is to download and install Regenerate Thumbnails. It does exactly the same, but does not delete image sizes that are unneccesary
When adding a new photo to wordpress post, you have have the option to select the size of the image like you can see here:
Is there a way to edit the size of these images? The max width an image can be in a post is 598px, so is there a way I can specify width 598px for any of these?
Is there a way to switch all previous posts from "Full Size" to whatever size has 598px?
You can set the various image sizes in the backend - Settings -> Media
There you can set Thumbnail, Medium and Large.
To regenerate all the image sizes again after they have already been uploaded and resized by Wordpress using the old settings you would use the plugin Regenerate Thumbnails
Don't be misled by the name of the plugin (which although technically correct from a WP point of view is pretty misleading I would say). The plugin regenerates all the image sizes, not just the thumbnail size. It doesn't regenerate the original full size version of course, just the three sizes you set in the Media settings.
The plugin author confirms it here -> Regenerate all image sizes