I’m trying to take existing images and shrink the file size down by resizing to photos to a smaller resolution. I’ve tried a few methods so far:
- Simply editing the photo in photoshop and reuploaded, replacing the existing (and larger) file.
- I tried the Imsanity plugin and set the options to be less than 1024×1024 and then bulk resized the images without failure (but it did not do the trick).
- I also tried the Regenerate Thumbnails plugin, and ran the rebuild without failure (but it did not resize the photos).
Maybe there is a better or a right way to accomplish what I’m doing, but I can’t seem to find anything on this issue.
I’m running a Multisite install and WP FTP is not enabled and can’t be enabled to solve this.
You can perform a combination of things to accomplish a smaller file size. Let me guide you through it.
Firstly, you could add custom image sizes and adjust the dimensions to the very smallest for their purpose. Put the following in your functions file:
So,
my_insert_custom_image_sizes
adds your custom images to the Media uploader window and I have added a few random sizes in thecustom_image_setup
.Next, we will need to set the JPEG compression value for each of these sizes. Observe the following:
As the comments demonstrate, this part sets the compression value:
imagejpeg($resource, $image, VALUE)
. You will need to play around a little bit and find out what value works best with which image size. I set 60% compression for the rest of images.The code above affects only newly updated images. If you wish to run a script that will change your existing images, in your plugin folder, add a new folder and create a new php file with this code inside:
Finally, add the WP Smush.it plugin which will bring down the file sizes even further.
A few notes to consider:
Full size
size option. This is the original file upload. If you are running a multiple author site and want to avoid your authors adding this filesize, you could add a filter to remove this file size from the drop down list.You can use wp-smush it plugin
http://wordpress.org/extend/plugins/wp-smushit/
It reduces the size of images