Images & why you need com_resize

I the release post of com_resized there was asked the question why one should use com_resize. There are three reasons to use it:

  1. The generated images aren the size you want them to be. So they’re smaller of size than the original images.
  2. You won’t get any ugly resized images (see the example below).
  3. It works with remote images. So you can link to an image one someone else’s blog and they get resized to the size you want + cached. So that way they get loaded from your own server: so faster.

No more ugly resized images:

The one on the left is without com_resize. The one on the right is _with_ com_resize. If you don’t see any difference. Your browser is probably doing some fancy stuff with the image. In that case you don’t need com_resize. But maybe the readers of your blog do!

For the people who don’t see any difference (leave a comment with your OS + browser, please!) I have attached a screenshot. Made in IE6, so the font is ugly too :)

8 comments ↓

#1 Roger on 05.26.08 at 16:33

Hi Leon

Thank you for your explanations and thank you for your work but… sorry to insist. There is a copy of the phpThumb script well documented inside of your resize plugin. But no documentation how to implement any code of com_resize in wp? In your example above your using also the phpThumb code? Or is there something else..?: …wp-content/plugins/com_resize/phpthumb/phpThumb.php?src=/wp-content/uploads/2008/05/space_station.jpg&q=90&w=200″ alt=”" width=”200″/>.

:-) Thank you in advance

#2 LeonB on 05.26.08 at 17:20

Hi Roger. Thanks for all your comments :p Else my blog would be so empty :)

I had some nice api for phpThumb planned for the next version of com_resize (nice mod_rewrite url’s).

I don’t even know how my plugin reacts if you add some phpThumb url filter’s to the image.

#3 Roger on 05.26.08 at 17:33

Hmmm… I think you dont understand what I need….

Question:
How do I use your resize code in wp? Please make me 1 example how you integrate the IMG tag… and resize..?

%-)

#4 LeonB on 05.26.08 at 20:23

That’s very simple: insert an img with a width and/or height attribute and it will be automatically resized! The original image is then replaced with a link to phpThumb.php?src= and the original image will be resized.

Ow yeah: the original image will only be resized if the image-width and the width/height in the tag-attributes are different.

#5 DuncanC on 05.27.08 at 11:31

When does the re-sizing occur? When you create the post/page in WP, or when the page is loaded?

One of my clients has added pics (straight from the digital camera) to a WP page (see the Efficient Recycling page on the website link above). These are the WP Thumbnail pics, but load really slowly. I’ve installed the com_resize plugin and activated it… so how do I get the images on the existing page to re-size.

Thanks (if this “does what it says on the tin” …. your plugin will be added to all my clients sites!!!)

#6 LeonB on 05.27.08 at 11:39

DuncanC: they are resized when the page is loaded.

I had the same problem: one of my clients (a Ducati dealer) posted hi-res pictures on their site. That’s why I created this plugin.

All you have to do to resize the images is: add an image, add a width and/or height attribute and reload the page!

I looked at the link you posted and it took this img as an example:
http://thinkpinkskips.co.uk/wp-content/uploads/2008/05/pict0002-300×224.jpg

I think the problem is that the difference between the real width/height(300×224) and the width you want (275×210) is too small. I believe the difference should be at least 12%. But you can find that number in the sourcecode (and adjust it if you want).

#7 Robert DeBenedictis on 11.13.08 at 02:41

Hi Leon,
I use com-resize and think it’s great.

I have WordPress installed in a /wp subdirectory.
Many of my images are in /wp/wp-content/uploads
and those work fine. But, some of my pre-Wordpress
images are in /images — those do not work.

For example, this (remote image) works:
http://transom.org/wp/wp-content/plugins/com-resize/phpthumb/phpThumb.php?src=http://www.transom.org/guests/review/200801_creature_comforts/assets/thumbnails/water_bugs_80.jpg&w=80

But, this (absolute to docroot) image does not:
http://transom.org/wp/wp-content/plugins/com-resize/phpthumb/phpThumb.php?src=/guests/review/200801_creature_comforts/assets/thumbnails/water_bugs_80.jpg&w=80

It seems that the version of phpThumbs that comes
with com-resize sets the phpThumbs ‘document_root’
to be that of the WordPress address (URL). That in
turn prevents phpThumbs from working with images
that are not under the directory where WordPress is
installed. Is that correct?

Robert

#8 LeonB on 11.13.08 at 08:42

@Robert: I think you are competely right. I’ll try and have a look at it tonight and fix it. Thanks for the report!

Leave a Comment