[theme-reviewers] Why the bias?

Otto otto at ottodestruct.com
Tue Feb 15 05:49:26 UTC 2011

On Mon, Feb 14, 2011 at 11:16 PM, Philip M. Hofer (Frumph)
<philip at frumph.net> wrote:
> Let me clarify, its usage is apparently inside the editor which makes no
> difference to how it is viewed in output to the end user.  Which makes the
> whole functionality of it not useful.

No, look... I know for a fact this works. I use it all the time. What
you need to understand is how exactly it works...

Firstly, it only applies to "large" images.

So, when I upload an image, the image gets resized into thumbnail,
medium, large, and "full" which is not really a resize at all. These
get saved. The resize proportions used are user defined in the
Settings. Those can be anything you like.

The image_constrain_size_for_editor() function gets called when it's
pulling image sizes to insert into a post. In the specific case where
the "large" image is being inserted, and it's greater than the
$content_width, then the large image will be inserted but it will get
width and height properties on it scaled down to the $content_width
size. Meaning that though the large size image is loading, the browser
itself will do the scaling down of the image to fit within the post
content area.

Now, if your CSS is wonky, this might not always work. And different
browsers behave differently. But the width and height still do get set
in the image properly.

It even works in twentyten. I just tried it. Bam, worked. The "large"
size was set to 1024x1024, but what I see when I use the media
uploader gives me a result like this:
<a href="http://localhost/wp/2011/01/image-test/mcm_6241/"
rel="attachment wp-att-354"><img
alt="" title="MCM_6241" width="640" height="425" class="alignleft
size-large wp-image-354" /></a>

Note two things there. The image is this:

But the image tag contains this:
width="640" height="425"

This is because twentyten has its $content_width set to 640. Really.


More information about the theme-reviewers mailing list