• When looking at the source code for an image embedded in a post. I see this.

    <a href="IMAGELOCATION.jpg"><img class="alignnone size-full wp-image-503" src="IMAGELOCATION.jpg" alt="IMAGE NAME" width="932" height="1210" /></a>

    My question: Where is the width=”932″ height=”1210″ getting generated in the wordpress code? I need to see if I can edit that (for reasons, I am trying to replace it with inline CSS style=”max-width:932px; max-height:1210px;”). For the life of me I cannot find where it is generated. I modified the image_hwstring in media.php but it seemed to have no effect.
    Thanks,

    -Ken

    P.S. Since I think this will require modifying core WordPress functions I thought this went more under hacks than themes.

Viewing 1 replies (of 1 total)
  • Moderator bcworkz

    (@bcworkz)

    I believe it is created from javascript. When the media library loads, an AJAX call is made for a page worth of images, then again for the next page, etc. The AJAX call returns a JSON structure with image data, the actual images are requested from the URLs in JSON. The image sizes are also in JSON, the data is used to insert the image reference into the content.

    The AJAX call executes wp_ajax_query_attachments(). I’ve no idea where the javascript comes from other than probably wp-includes/js somewhere. I hope this at least narrows your search.

    FYI, please never ever consider modifying core functions. If you are clever there is almost always a way to do something through actions, filters, jQuery, etc. In fact, those that advocate modifying core are not welcome here. The only way one should modify core is by submitting a patch through Trac for commitment by greater authorities for everyone to use.

Viewing 1 replies (of 1 total)
  • The topic ‘Img width and height HTML code generation location?’ is closed to new replies.