Dream Wordpress image resizer plugin...
February 11, 2008 3:05 AM   Subscribe

Crazy Wordpress plugin request: A way to automatically resize and autocrop images and place them into a post without manual uploading - just providing an image url from elsewhere on the web.

I'm working on a news like site that I'd occasionally like to grab images off of another site, and then resize them with predefined dimensions without changing the aspect ration.

As a practical example, think Google News - they snag pics from news articles, and then thumbnail them. As for predefined aspect ration, think Flickr, and how they will simply "square off" images as a thumbnail option.

To save the time of downloading, then reuploading, I'd like to find a plug in that can automatically take and resize the image from an image URL.

This dream plug in would also be able to automatically insert the altered image into entries, likely using custom fields.

Finally, and this is gravy, but this would also allow for different image sizes depending on where the entry would appear - front page, archive listings, or the post page.

Help?
posted by Unsomnambulist to Computers & Internet (8 answers total) 6 users marked this as a favorite
 
It's not a plugin, but I use ScribeFire for exactly this. Once you've set it up, you can literally drag a picture in from a web page or any other source, size it using handles on the corners and hit post. It's incredibly intuitive and quick.
posted by Happy Dave at 3:25 AM on February 11, 2008


For what it's worth, a lot of people frown on hotlinking to their images, and may install plugins to stop you from doing so. I, for one, have been trying to block hotlinking because it messes with my page hit stats.
posted by sjuhawk31 at 5:48 AM on February 11, 2008


Nathan's PixGallery plugin might be helpful. Besides the image gallery features, which you can ignore, pixgallery will automatically resize an image to match whatever width and height you put in the img tag.. (I don't think it does cropping, though.) So in theory, if you put [img src="http://somebody-else's-website/img.jpg" width=300 height=200] in an entry, PixGallery will fetch a copy of that image, resize it, store a copy on your site, and change the img tag to point to the local copy. I'm used to typing my html by hand, so I prefer this approach to a draggy-droppy interface.

I say in theory because it only works if your web hosting service allows PHP to go fetch stuff from other sites. Dreamhost doesn't allow it, so I've never actually been able to use this feature.
posted by moonmilk at 6:15 AM on February 11, 2008


sjuhawk31: I don't believe he wants to just link from the site. He wants to upload a resized image to his server.

At any rate, here is my suggestion:

Simply change the default thumbnail size in WordPress itself. WordPress creates thumbnails for you when you use the web-interface to upload images.

Go into /wp-admin/inline-uploading.php and look for:

if ( $imagedata['width'] > 128 && 
$imagedata['width'] >= $imagedata['height'] * 4 / 3 )
      $thumb = wp_create_thumbnail($file, 128);
    elseif ( $imagedata['height'] > 96 )
      $thumb = wp_create_thumbnail($file, 96);
By default thumbs are created at 128x96. Just change these values to whatever fits your theme or purpose. The ratio will remain the same, depending on what side is longer.

Note that the numbers are in 2 locations above, so change them both.
posted by travis vocino at 7:07 AM on February 11, 2008 [1 favorite]


In which case, absolutely figure out and publicize a way to do this. I want my stats to be accurate, damnit! There's no way I get 30 hits a day!

...sigh.
posted by sjuhawk31 at 8:34 AM on February 11, 2008



For what it's worth, a lot of people frown on hotlinking to their images, and may install plugins to stop you from doing so. I, for one, have been trying to block hotlinking because it messes with my page hit stats.


I don't think this is what he wants to do (because wordpress can already do that). I think we're talking about:

1. Add image URL
2. At post time (or previously), image URL gets curl_get'ted or whatever, resized, and then placed in a local directory -- src link is then corrected.
3. ???
4. you know what.

I've had this request a couple times from people I've worked for. It wouldn't be terribly hard to do -- I'd probably mod the image script pop-up so that if a non-local directory were entered, the scraping+thumbnailing would happen then. At that point, however, it'd probably be a "hack" rather than a plugin, as I don't think WP has any plugin hooks in that particular script.

That said, I'm not sure of any existing plugs to do this.
posted by fishfucker at 9:22 AM on February 11, 2008


ha, and that would be because i didn't fully read moonmilk's comment. So there you are. Sounds like as long as you have curl installed you'd be set.
posted by fishfucker at 9:23 AM on February 11, 2008


Response by poster: Thanks for the tips.

And no, the idea here would definitely NOT be to hotlink images. In fact, the concept would be to drive additional traffic to other sites (even though I'd be copying some of their images to do this).
posted by Unsomnambulist at 2:30 PM on February 11, 2008


« Older Is there a website that has graphs of stock price...   |   What's the best way of distributing a DVD over the... Newer »
This thread is closed to new comments.