• Resolved SJPUK

    (@sjpuk)


    Hi,

    I am in the process of customising my WP theme, but I am having an issue with the image sizes (widths to be specific).

    I have made the theme wider, but even when I choose the largest image, there is HTML for the image that forces it to be a maximum width of 970px. I have added an image that is 1170, but still, this is the HTML that is generated by the get_content().

    I am at a loss where all this HTML comes from? A direct copy from the HTML on the page is

    <img data-attachment-id="813" data-permalink="https://www.stevenparkes.co.uk/2017/09/29/first-film-lomography-bellair/20170928-420/" data-orig-file="https://i0.wp.com/www.stevenparkes.co.uk/wp-content/uploads/2017/09/20170928-420-e1506970579938.jpg?fit=1170%2C591&ssl=1" data-orig-size="1170,591" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Steven J Parkes&quot;,&quot;camera&quot;:&quot;Bellair&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1506428688&quot;,&quot;copyright&quot;:&quot;Steven J Parkes&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Courtyard" data-image-description="<p>Courtyard</p>
    " data-medium-file="https://i0.wp.com/www.stevenparkes.co.uk/wp-content/uploads/2017/09/20170928-420-e1506970579938.jpg?fit=300%2C152&ssl=1" data-large-file="https://i0.wp.com/www.stevenparkes.co.uk/wp-content/uploads/2017/09/20170928-420-e1506970579938.jpg?fit=970%2C491&ssl=1" class="wp-image-813 size-full" src="https://i0.wp.com/www.stevenparkes.co.uk/wp-content/uploads/2017/09/20170928-420-e1506970579938.jpg?resize=970%2C490&ssl=1" alt="Courtyard" width="970" height="490">

    If I view the section of code in the developer part of chrome, and I remove all references to 970, then the image does re-size to 1170, but obviously on re-load it’s back to 970. Where is all this HTML coming from?

    The page I need help with: [log in to see the link]

Viewing 4 replies - 1 through 4 (of 4 total)
  • Looks like there’s code being added onto each image. Look at the path here for the image https://i0.wp.com/www.stevenparkes.co.uk/wp-content/uploads/2017/09/20170928-420-e1506970579938.jpg?resize=970%2C490&ssl=1

    Can you switch themes for a moment to see if that persists? If it does then it may be a plugin issue. If it fixes – then at least we would know that it’s a theme command forcing it to resize.

    Beautiful images 🙂 by the way

    Thread Starter SJPUK

    (@sjpuk)

    Hi,

    Thanks for the quick reply!

    Right, I just activated Twenty Sixteen, for a moment, just to get the img src, and i got this … which probably isn’t a right lot different, other than the width is 840px, which is probably the width being defined by the Twenty Sixteen theme somehow? When I have tinkered with themes in the past, I have never seen anything like this …

    <img data-attachment-id="813" data-permalink="https://www.stevenparkes.co.uk/2017/09/29/first-film-lomography-bellair/20170928-420/" data-orig-file="https://i0.wp.com/www.stevenparkes.co.uk/wp-content/uploads/2017/09/20170928-420-e1506970579938.jpg?fit=1170%2C591&ssl=1" data-orig-size="1170,591" data-comments-opened="1" data-image-meta="{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;Steven J Parkes&quot;,&quot;camera&quot;:&quot;Bellair&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;1506428688&quot;,&quot;copyright&quot;:&quot;Steven J Parkes&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}" data-image-title="Courtyard" data-image-description="<p>Courtyard</p>
    " data-medium-file="https://i0.wp.com/www.stevenparkes.co.uk/wp-content/uploads/2017/09/20170928-420-e1506970579938.jpg?fit=300%2C152&ssl=1" data-large-file="https://i0.wp.com/www.stevenparkes.co.uk/wp-content/uploads/2017/09/20170928-420-e1506970579938.jpg?fit=840%2C425&ssl=1" class="wp-image-813 size-full below-entry-meta" src="https://i0.wp.com/www.stevenparkes.co.uk/wp-content/uploads/2017/09/20170928-420-e1506970579938.jpg?resize=840%2C424&ssl=1" alt="Courtyard" width="600" height="303">
    • This reply was modified 8 years, 8 months ago by SJPUK. Reason: incorrect html
    • This reply was modified 8 years, 8 months ago by SJPUK. Reason: incorrect html
    Thread Starter SJPUK

    (@sjpuk)

    Aha!

    I found that there is a variable $content_width that can be set. I have never used this in themes before, clearly I have been doing things the hard way. So I looked through the themes ‘functions.php’ and found the following …

    if ( ! isset( $content_width ) ) {
    $content_width = 1170; /* pixels */
    }

    I have now set $content_width to the desired size, and all seems to be ok :o)

    Thank you for the reply, and it helped me understand that the width was being drawn from a setting that could not be set in the normal control panel for WP.

    Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Image Sizes, WordPress’ is closed to new replies.