WordPress.org

Ideas

Make sure images in posts doesn't break / misalign when changing themes

  1. Angry Creative
    Member

    12345

    There's a big problem with how WP handles images in posts. If I put images in my posts / pages with the wysiwyg they use one of my preset sizes - thumbnail, medium, large or full-size. This is all great, but when I change my theme and the new theme uses a different size - my images doesn't change their appearance.

    This has produced a situation where I can only use the "Selected image" and the "gallery" function if I don't want to put in lots and lots of hours changing that stuff manually.

    The naming convention is the biggest problem. In wp 3.1 we have the "resize thumbnails" action, but that doesn't help much, since all images are saved with their size hard-coded into their filename.

    Instead, I'd use a naming convention like this:
    image-filename-thumbnail/medium/large/full-size/custom-size.jpg

    If I'd use something like that, there would be no problems when changing theme. All you'd have to do is re-size the images, and you'd be good.

    This thing is extra annoying when exporting / importing your site. Since the export plugin as-is exports 'filename.jpg' but not 'filename-size.jpg', you'll get a blog full of broken images. Not cool!

    Posted: 3 years ago #
  2. Pat Hawks
    Member

    12345

    The gallery function never references any URLs. As soon as you change an image size, it will be reflected in all of your galleries, so no worries there.

    Posted: 3 years ago #
  3. Angry Creative
    Member

    12345

    Dude, read my post again. I know that - its the "regular" images that are affected.

    Posted: 3 years ago #
  4. Ipstenu (Mika Epstein)
    Administrator

    Unlikley to happen, as it would have to be backwards compatible somehow. With the sheer volume of themes, there's next to no way to do that and not break things.

    Besides, the DB actually stores 'image-100x100.jpg == thumbnail' in there which has the functionality if not the 'pretty' factor.

    Posted: 3 years ago #
  5. Angry Creative
    Member

    12345

    Yeah, this is most def not a thing that seem likely to happen in a smaller update, but in a major update it is nescessary.

    Posted: 3 years ago #
  6. Ipstenu (Mika Epstein)
    Administrator

    Even with a major update, WordPress has an obligation to ensure as much backwards compatibility as possible. With major changes like PHP and SQL versions being dropped, the entire product was written such that you couldn't upgrade if you had the older versions.

    This would be exceptionally difficult to manage, as there's not a one way to detect if people are using the old way (however we can assume everyone does), and WHAT the correct new way would be.

    If we were re-building, sure. But in an upgrade? The benefit is pretty low when compared to the mountain of work required/

    Posted: 3 years ago #
  7. Angry Creative
    Member

    12345

    We can agree to disagree. What's difficult to manage is when you import a blog / switch themes and you have LOADS AND LOADS of either broken images, or images that are not their "proper" size.

    This can be done today with a simple SQL search / replace.. I guess this is pluggable, but it's madness that it's not in core.

    Posted: 3 years ago #
  8. Ipstenu (Mika Epstein)
    Administrator

    This can be done today with a simple SQL search / replace

    Right which is why it won't happen :) WordPress, and really most CMS tools, do not screw around with the content of your data. Heck, WP doesn't even like to add/remove tables or even columns and rows IN tables with updates! Why? Cause it breaks stuff.

    This is a 'speaking from experience' voice.

    You're right, it would be better, but it's too high risk with too low a pay off to attempt on over a million websites. People would be very unhappy if we had an 80% success ratio, because that's 20% dead sites.

    What's difficult to manage is when you import a blog / switch themes and you have LOADS AND LOADS of either broken images, or images that are not their "proper" size.

    There are image resizing plugins just for that situation.

    1) Images should never "break"

    2) If your THEME calls a specific image name (mine does), it is supposed to gracefully fall back. At the worst, it should just grab the full sized image and use width/height to resize the bad way.

    Plugins you may find useful:
    http://wordpress.org/extend/plugins/auto-image-resizer/
    http://wordpress.org/extend/plugins/regenerate-thumbnails/

    Posted: 3 years ago #
  9. Angry Creative
    Member

    12345

    In fact, images 'break'. But that's a bug in the import function.

    Not too long ago I exported a site from one WP to another. The new site had a different theme, and thus used different image sizes for thumbnails + medium & large images.

    It exported the images all right - but since it only exports the "main" (full-size) image and then generates new thumbs+mediums+large, all of these images were "unlinked" in the content.

    And thus, if you do a regular theme switch the images gets "messed up", but if you import your blog with a new template and new settings, it actually breaks.

    Nuff said :)

    Posted: 3 years ago #
  10. Ipstenu (Mika Epstein)
    Administrator

    I've done the export/import dance many times (did it two months ago, in fact) and I've never had an issue with that. All my images remained linked. I've changed thumbnail/medium size specs many times as well, nothing 'breaks' and they all stay linked on my old posts, and correctly resize on the new ones.

    I think that's a separate issue, personally (along with a 'works for me' bug report), but suffice to say, this is a 'not right now' request.

    Posted: 3 years ago #

RSS feed for this topic

Reply »

You must log in to post.

  • Rating

    12345
    4 Votes
  • Status

    Sorry, not right now