WordPress.org

Ready to get started?Download WordPress

Forums

Image resizing when inserting into a post (5 posts)

  1. CJ
    Member
    Posted 2 years ago #

    In my Media Settings I have image sizes of:

    Thumbnail size
    width: 110
    height: 110

    Medium size
    width: 45
    height: 9999

    Large size
    width: 960
    height: 9999

    I have an image on my computer, I want to insert into a post at its full size which happens to be 110x110 - the same dimensions as my Thumbnail Size. When I go to upload and insert it, the "Full Size" radio button is selected by default and the dimensions display beneath it read (110x110) - none of the other radio buttons for "Size" can be selected.

    Since it reads (110x110) I figure I'm good, that's what I want it to display at. However, after clicking "Insert into Post", and updating the Post ... I of course view the post. This is where I get hung up...

    The image in the post displays at the width of my "Medium size" setting - 450 wide. My single-post.php file doesn't seem to have any coding to suggest it prefers the Medium size images. The css wrapped around the image includes (size-full).

    So basically I want this image to show up at whatever image size I specify when I insert it into the post. For some reason WordPress insists on resizing, as-if my single-post.php only wants to display images of 450px wide.

    Any ideas on how to resolve this would be most appreciated.

  2. vtxyzzy
    Member
    Posted 2 years ago #

    You might try installing the CKEditor plugin. It will let you resize IN the post, independently of WP.

    After you install and activate the plugin, edit the post, click on the image, and click the Image icon (looks like a square with the sun and a house - usually in the top row). You can change the displayed size, spacing and alignment there.

  3. wpismypuppet
    Member
    Posted 2 years ago #

    It seems like there is something in the code itself telling the image to come out a certain way. Can you post a link to an example? We can use firebug to see what's going on maybe.

    Also, by default... WordPress will only "crunch" different sizes of the given image, on upload, if it is larger than the dimensions you specify in the media settings. Since your image is 110x110, WordPress won't crunch up... so that's why the only radio button option you have is full size. And because the dimensions of the image exactly match the thumbnail dimensions, WordPress won't even crunch a thumbnail... It has to be larger by at least one pixel.

    Because of this logic, WordPress is NOT resizing the image on upload... there is something in the code telling it to add a "width" and "height" attribute to the img tag itself.

    So, if the page in question were trying to use the "medium" setting for your image, it would attempt to pump out:

    http://mysite.com/wp-content/uploads/myimage-45x9999.jpg

    as an example. Since WordPress does crunch up, a 45x9999 image was never made! Therefore, WordPress would not find that image, and default to the full sized version, or myimage.jpg. However, the function used to echo out that image would also include a "width" and "height" attribute to the img tag, which would still be width="44" height="9999", so there's your problem.

  4. stueynet
    Member
    Posted 2 years ago #

    Is there a way to force it to crunch if the image is the same size. The issue is that when a client creates an image they don't often optimize it so they may upload a properly sized image that is still very large in file size and because it doesn't get crunched, it displays this large image. It would be great to force the cruncher to optimize the image even if it is the same size so that images are guaranteed to be optimally compressed.

  5. wpismypuppet
    Member
    Posted 2 years ago #

    Aside from writing your own PHP code to intercept the files on upload and optimize them yourself, no... there is no way to force WordPress to crunch a file if the dimensions match.

    The whole file upload process needs an overhaul in my opinion. Even files that produce errors are still put up on the server incorrectly instead of being removed and an appropriate error message displayed to the end user. What can you do?

    We are thinking of writing our own plugin to fix these problems. If we do, I'll let you know and you're free to have it! Need permission from the bigwigs to let me spend time on it though...

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.