• Resolved Will Hawthorne

    (@wilirius)


    When I upload an image of say size 940×300 it is being resized by wordpress with the extension 940-300. This is completely unnecessary and also creates a worse image because the full size image IS already that size and optimized.

    I was pretty sure that WP did not create this redundancy, yet I am witnessing it in the most recent theme I am using.

    I am also using wp_get_attachment_image_src as it is the command which is searching for the image and returning the one with the extension.

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter Will Hawthorne

    (@wilirius)

    In other words, why is WP resizing to the size that it already is.

    What theme are you using? Where did you download it from?

    Thread Starter Will Hawthorne

    (@wilirius)

    It is from thememonster, and edited a good bit.

    add_image_size( ‘mySize’, 940, 300, true );

    Note that hard-crop is set to true, but no crop should be necessary! And no resize should be necessary.

    Can you replicate the problem using the default Twenty Twelve theme with all plugins deactivated? I’m sorry but as you are using a non-WPORG theme, you need to seek support from the theme’s developers – paid or otherwise. We only support themes downloaded from www.remarpro.com here.

    Thread Starter Will Hawthorne

    (@wilirius)

    Yes, I can duplicate the problem with Twenty Twelve with all plugins deactivated.

    I added a custom image size :

    add_image_size( 'mySize', 940, 300, true );

    I added the image to a fullwidth page to test it:

    <?php
      $myImage = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), 'mySize');
      echo "<img src='";
      echo $myImage[0];
      echo "' alt=''/></a>";
    ?>

    I uploaded an image to test this with while Twenty Twelve was activated.

    The image was still resized/duplicated despite already being the correct size.

    I added a custom image size

    And that is where the issue is being created. By including that line you are specifically asking WordPress to create this new image. If you are uploading images of the correct size, why do you need add_image_size() at all?

    Thread Starter Will Hawthorne

    (@wilirius)

    I tested it with a new upload and

    add_image_size( 'mySize', 940, 300);

    The issue still exists.

    Thread Starter Will Hawthorne

    (@wilirius)

    Ah, ok. It is for future proofing. If someone else uploads an image in the future and uses a wrong size then I would prefer it to have been adjusted to the appropriate size via resizing.

    Then I’m afraid you’re pretty much caught between a rock & a hard place. If you want to future proof image uploads, then you’ll have to trade that off against the odd image being replicated. As far as I’m aware, there’s nothing in WordPress core that can be easily used to determine the image size during the upload process and apply add_image_size() conditionally. Well, not unless you want to get into some pretty hefty custom coding.

    Thread Starter Will Hawthorne

    (@wilirius)

    Thanks esmi! I could’ve sworn I had seen it done before, and I just assumed it was WP doing the work, so I’ll go back and look around for it. But like you’re saying it might have been some javascript to replace the img src or something else. Thanks again.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Uploaded image is being resized to the same size as full’ is closed to new replies.