Support » Plugin: Enable Media Replace » Updating width/height in the HTML

  • Resolved GermanKiwi


    Hi Måns,

    As far as I can tell, when I replace an image with another image using your plugin, the plugin does not change the IMG width and height values in the HTML code – is that correct?

    So for example, if I have an image that is 300×60, and I insert this into a page, the page will use this HTML:

    <img width="300" height="60" src="">

    And if I use your plugin to replace this image with another one that is bigger, and I select the option “Replace the file, use new file name and update all links”, the plugin will replace the file and update the links for sure, but I think it won’t update the width= and height= values – right? At least I found this to be the case just now when I tried it.

    Is there any chance that you can make your plugin also update the width/height values in the HTML at the same time that it updates the file links, on each page? Surely if the plugin can update the file links, it can update the width/height too?

    BTW I’m not talking about thumbnails, but about the full-sized version of the image. (Maybe this could be an option – the user who replaces the image, can have a check-box there (disabled by default) which would tell the plugin to also update the width/height values in the HTML. Then the user can decide if this is necessary or not, or whether it might break something else).

    What do you think?


Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Måns Jonasson


    You are correct, and the main reason is because I have no 100% reliable way of detecting all image tags in HTML content, and because some image embeds are done with a certain size for a reason. If I replaced all width and height arguments, I could end up breaking a layout on some pages, and I never want to do that.

    Right, yes I understand your point. But what about having there just as an option – with a checkbox for example – the user can check the box if they want the plugin to also update the height/width values too. Then everyone wins!

    IF someone does want to replace an image with another image that is a different size, then in most cases they should already be aware of how that will affect the layout of their page. So it’s up to them to make sure that it doesn’t.

    And really, it’s no different to the user uploading a brand new image (with a new entry in the Media Library) and then going to his page, deleting the old image there and inserting the new image – he still has to make sure the new image doesn’t break his layout. The biggest advantage of your plugin is that it makes this process so much faster and easier – instead of uploading a new image to the Media Library and deleting the old one after, I can just use your plugin to quickly replace the image itself. But the consequences are the same – in either case, I have to make sure my new image doesn’t break my layout. Therefore I think it makes sense for the plugin to be able to update the height/width, as an option, as this will also save a lot of time for many people! Do you see what I mean? 🙂

    Plugin Author Måns Jonasson


    I do understand, but even so, there is no fool-proof way for me to see exactly how images have been embedded in the content, since it can be done many different ways.

    Okay. Well, what about adding some warning text on the Replace Media Upload page, to alert the user to the fact that they will need to update the height and width values on each page that the image is used, if they are replacing the old image with a new one that has a different size.

    That will give a helpful reminder, especially for the users who don’t realise the need to do this.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Updating width/height in the HTML’ is closed to new replies.