0

I've got a blog that has the highest-resolution version of all its images embedded in the posts, rather than a thumbnail linking off to an image attachment page.

Can you tell me how I can re-process all embedded images so they're output as reduced size thumbnails that link off to their own attachment page (which is WordPress default settings)?

Am I right in thinking I can involve the Regenerate Thumbnails plugin in this?

2 Answers 2

1

When you insert an image into a WordPress post, its display size is determined by the size setting you pick on the insert dialog:

The size setting on the insert image dialog

If your server is configured to support WordPress's image resizing (most common hosts configure their servers so this isn't an issue), a resized version of the image you enter should be used so you're not forcing a visitor to download a large image and then smushing it down with HTML width and height attributes.

If you find that you've inserted a "Medium" size image but the file being download is huge still, then Regenerate Thumbnails should work. However, if you inserted the images at Full Size and your theme is making them fit the body's width, then regenerate thumbnails won't do anything for you. Unfortunately, in looking at your blog, it seems that this latter scenario is what you have.

The only way you can address this, then, is to set the "Large" size to match the width of your content area and then reenter each image. I don't know of any other way.

One other way that won't work is to change the image size in the "Advanced Image Settings":

WordPress Advanced Image Settings

Again, all this will do is resize the image in the browser. It won't change the file size or dimensions of the image being displayed.

3
  • Thanks for this, I was starting to realize that each of these images will need to be re-embedded using the correct method (which creates a thumbnail and links to an attachment page). Is there no way of automating this process?
    – Alec Rust
    Commented Aug 28, 2012 at 9:54
  • Not that I've ever seen. The only thing I could possibly think of would involve a RegEx find and replace of your database to change file names, but that's not something I can do.
    – mrwweb
    Commented Aug 28, 2012 at 14:54
  • That's fair enough, thank you for your responses. Have opened this question to try and resolve.
    – Alec Rust
    Commented Aug 29, 2012 at 11:39
1

I've done this when the original uploads were too big and taking up too much space.

If you download just the full-sized images... for example: http://www.rustyrambles.com/wp-content/uploads/2012/08/springsummer12-270.png then you can resize it on your computer. and then FTP it back into the wp-content/uploads directory (more complicated if you are ordering by month/date) so that it replaces itself. Then if you are using other sizes, you can run Regen Thumbnails, but as mrwweb mention, regen isn't the answer for images that have been inserted.

it looks like

<img class="alignnone size-full wp-image-1036" title="zincwhite bracelet" src="http://www.rustyrambles.com/wp-content/uploads/2012/08/springsummer12-270.png" alt="" width="490" height="490">

so if you processed the image offline down to 490x490 and FTPed it back... you wouldn't screw up the proportions of the image. Otherwise you'd need to loop through the posts and preg_replace the heights and widths and that just isn't fun. Only looked at 1 other image and it's width was also 490, so perhaps you can batch process the images to that width and let the heights be determined proportionally.

4
  • Unfortunately manually uploading a resized version of these images is not an option. This needs to be an automatic process that also creates and links to an attachment page for each image.
    – Alec Rust
    Commented Aug 28, 2012 at 9:52
  • oh well if you want to wrap every image in a link to the full image (which is still too big imo) then you are going to need some complex preg_match type expressions. way beyond me. i doubt the image on your attachment page needs to be as big as you have it.... so you could still try my answer. it is a partial solution. Commented Aug 28, 2012 at 12:54
  • I don't want to wrap every image in a link to the full image. The full image is currently being embedded in the post (which as you say is too big). What I want is these to be replaced with thumbnails linking to attachment pages, which would in turn link to the full resolution image (this is default WordPress functionality).
    – Alec Rust
    Commented Aug 28, 2012 at 12:59
  • ok then, but you are still needing to match the images and replace them... that's preg_match/preg_replace/regex type of stuff and is more difficult than i can help with. you could get_posts() and do a loop to wp_update_post() to update the post_content, but the regex matching will be tricky. Commented Aug 28, 2012 at 13:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.