Skip to main content
Share Your Experience: Take the 2024 Developer Survey
8 votes

add_image_sizes ignoring crop sizes and using proportion

WordPress "crop" doesn't literally mean crop. As in take an image and cut out this precise portion of it from specified point. What it roughly means is: resize image to fit as well as possible, then ...
Rarst's user avatar
  • 99.7k
6 votes
Accepted

using media uploader to select image of specific size, enforce cropper

First use the code given by @Darren on any page. For simplicity I've combined PHP and JS code in single block: <?php $heading_picture = esc_attr(get_option( 'heading_picture' )); ?> <...
Vivek Athalye's user avatar
5 votes

using media uploader to select image of specific size, enforce cropper

It looks like the select and crop functionality is currently only used in the WordPress Customizer. However, after looking over the code in the Admin folder of WordPress I was able to get it working ...
Darren's user avatar
  • 151
5 votes

How to delete resized (cropped) image uploads and prevent future resizing?

You can easily delete files using "find" command on linux, just needed to do the same thing. You can run the following in bash console: cd /var/www/wordpress/wp-content/uploads find -type f -regex '.*...
mwdev's user avatar
  • 151
5 votes

How to delete resized (cropped) image uploads and prevent future resizing?

A majority of the answers covered how to stop creating future default image sizes but this doesnt account for creating any custom sizes in your theme but here is another solution to add to functions....
user9447's user avatar
  • 1,772
4 votes
Accepted

Why does the Hard Crop option Scale?

They are not the same. In the 800x350 image, a little bottom is cropped. This is how the hard cropped work: First, it scales your image to match your image size. It can be width or height. Your size ...
Tung Du's user avatar
  • 875
4 votes

"There has been an error cropping your image" when cropping image

There is too little information to be completely sure, but usually this error occurs when WordPress cannot find the graphic library which should be installed on your server. So you should check with ...
cjbj's user avatar
  • 14.6k
3 votes

"There has been an error cropping your image" when cropping image

I was facing same issue and unable to understand how to resolve this issue by following given ideas on every portals as I am not hardcore programmer so it was not possible for me to understand their ...
Nitin Tomar's user avatar
3 votes

"There has been an error cropping your image" when cropping image

I solved this installing the next library sudo apt-get install php5-gd -> for php5 sudo apt-get install php7.0-gd -> for php7 sudo apt-get install php7.2-gd -> for php7.2
Fabrizzio's user avatar
3 votes

get_the_post_thumbnail_url with an unregistered size

WordPress does not create any thumbnail on the fly. If you try to fetch a size that doesn't exist, either the closest size or the full size image will be retrieved. The closest solution you can try ...
Johansson's user avatar
  • 15.3k
3 votes

Local WordPress installation doesn't crop images

For the record since I ended up here when experiencing the same issue on my localhost: In php.ini, Uncomment the line with: extension=php_gd2.dll Restart apache / all services This sorted it out ...
anmari's user avatar
  • 1,501
3 votes

Custom image size / thumbnail - Crop to aspect ratio even when source image is smaller than set dimensions

This isn't a really good solution since it's a newer CSS solution and it's only working in 78.9% of users browsers, but there are a few polyfills that can overcome that object-fit-images and fitie ...
Bryan Willis's user avatar
  • 4,429
2 votes

Custom image size / thumbnail - Crop to aspect ratio even when source image is smaller than set dimensions

You're right that it just doesn't work like that. If it's OK to think of your question the other way around though, you can get the right outcome in modern browsers using a selection of image sizes ...
Andy Macaulay-Brook's user avatar
2 votes

Why WordPress automatic cropping all my images?

To disable cropping, insert this below code in disable-automatic-image-crop.php file in your mu-plugins folder: <?php /* Plugin Name: Disable Automatic Image Crop Author: Wordpress Community ...
Feriman's user avatar
  • 289
2 votes

How to delete resized (cropped) image uploads and prevent future resizing?

If coding is not your strongest point you may want to look at a plugin solution. What I have in mind is a suggestion of a couple free plugins residing in the WordPress repository: Media Cleaner by ...
marikamitsos's user avatar
2 votes

How to delete resized (cropped) image uploads and prevent future resizing?

No idea, how to remove existing images. But you can stop generating image sizes for new images you are going to upload. If you like to write codes: Place this code snippet in your theme's functions....
mukto90's user avatar
  • 1,354
2 votes

How to delete resized (cropped) image uploads and prevent future resizing?

If you have SSH access then you can run the following commands to list and remove the resized images. Later you can rebuild them. List all resized images. # List all resized images. # Usage: lrimg ...
Ahmad Awais's user avatar
2 votes
Accepted

Image with large file size not cropping

By default, WordPress uses the GD Graphics Library to resize and crop images. On servers with limited resources however, GD fails on images with large file sizes. If you really need to keep the size ...
ricotheque's user avatar
2 votes
Accepted

wp_get_attachment_image_src on multisite

wp_get_attachment_image_src() function returns an array that's why your code isn't working. Try the following code. <a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"> <...
obiPlabon's user avatar
  • 1,719
2 votes
Accepted

Use get/the_post_thumbnail with Custom Size & Crop

No, there's not a way to do this by using the_post_thumbnail(), neither it's recommended. What you are looking for is cropping the images on the fly. This will cost heavy server resources, especially ...
Johansson's user avatar
  • 15.3k
1 vote

How do I get a smaller size of an avatar image

get_avatar takes a second parameter according to the documentation for avatar size. If you're using a plugin that doesn't respect that, you'll need to reach out or check their documentation for a way ...
phatskat's user avatar
  • 3,144
1 vote
Accepted

Can't locate custom image sizes defined by child theme

These images sizes are defined by WordPress, and were added in WordPress 5.3. The comments in the source code describe them like this: These sizes are meant to enhance the way WordPress displays ...
Jacob Peattie's user avatar
1 vote

add_image_size is scaling, even though crop is set to true

The fact that GD is loaded doesn't mean it is actually used for handling the images. From the pastebin code you give I conclude that your theme comes bundled with the Kraken image optimizer (as a ...
cjbj's user avatar
  • 14.6k
1 vote

add_image_size is scaling, even though crop is set to true

I think your problem could be, that you need to set the high priority (try 101, or even 999 if it solves): add_action('after_setup_theme', 'add_custom_sizes', 101 );
T.Todua's user avatar
  • 5,800
1 vote

add_image_size is scaling, even though crop is set to true

from your question i under that you want fixed size cropped images when you upload image, why don't you use wp_get_image_editor. I used it in my project where i wanted cropped images of fixed size so ...
Vinit Soni's user avatar
1 vote

is it possible to crop cover images in buddypress?

The cover picture is not intended to be cropped. When you use this feature, the component tells you which min. image size should be used. If it comes up or not is depends largely of your theme and wp ...
Thilak's user avatar
  • 125
1 vote

Cropping an image before inserting into a post

I think you are good, but you don't need to use other functions. You have all in File: wp-includes/media.php For instance, you may _wp_get_image_size_from_meta to get the image dimensions, so you ...
prosti's user avatar
  • 4,283
1 vote

How to delete resized (cropped) image uploads and prevent future resizing?

Here's a way you can do this programmatically (for the most part). 1: Set your media sizes (ex: thumbnail 300x300 and the rest 0x0 to keep WP from generating anything other than thumbnail.) 2: ...
bristweb's user avatar
  • 111
1 vote

How to delete resized (cropped) image uploads and prevent future resizing?

To remove all superfluous image files, we'll have to loop through all posts, find the attachments to those posts, establish which attached image sizes are no longer needed and remove those files. Here ...
cjbj's user avatar
  • 14.6k

Only top scored, non community-wiki answers of a minimum length are eligible