[theme-reviewers] Why the bias?

Rahul Bansal rahul.bansal at rtcamp.com
Tue Feb 15 06:05:39 UTC 2011


Great observation Otto! :-)

I guess this solves an issue which was haunting me since long!
I use to manually set "large" size to my content-width and so I always
needed to edit "large" size whenever post-content width changed with my
theme! This used to create problems with old posts...

Still, rather than hard-coding height and width like
width="640" height="425"

WordPress can "push" CSS like
img.size-large {max-width: 640px}

where max-width will be value of $content_width

Using CSS based resizing may take care of change in $content_width whenever
theme changes.

Only thing CSS based height/width on image might have some glitches. As of
now I remember only IE6's lack of support for max-width attribute. There may
be more!

Another positive side of CSS-based approach is, CSS will go inside RSS
readers where post-content width may differ! It could be negative side as
well, depending on your perspective!

--
Rahul Bansal | Founder & CEO | rtCamp Solutions Pvt. Ltd.
Skype: rahul286 | Twitter: @rahul286 | Web: http://rtcamp.com/



On Tue, Feb 15, 2011 at 11:19 AM, Otto <otto at ottodestruct.com> wrote:

> 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
> src="http://localhost/wp/wp-content/uploads/2011/01/MCM_6241-1024x681.jpg"
> alt="" title="MCM_6241" width="640" height="425" class="alignleft
> size-large wp-image-354" /></a>
>
> Note two things there. The image is this:
> MCM_6241-1024x681.jpg
>
> But the image tag contains this:
> width="640" height="425"
>
> This is because twentyten has its $content_width set to 640. Really.
>
> -Otto
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20110215/ae57758c/attachment.htm>


More information about the theme-reviewers mailing list