TTR: ca. 57 Sek.
Home » Web & Code » WordPress » WordPress: „Native Image Resizing“

WordPress: „Native Image Resizing“

I tweeted it out not too long ago, and it seems to have gotten people’s attention. So why do WordPress theme developers still use TimThumb? One of the valid reasons seems to be dynamic image sizing. Of course if you’re using TimThumb for post thumbnails in your theme, your life saver is the add_image_size function — you don’t need “dynamic resizing” since all your thumbnails are of equal sizes throughout your theme.

However, the valid reason I seem to have bumped in, is the fact that sometimes you would want to use a specific size for an image, but only once, for one post or page. The add_image_size function here will add a lot of overhead, crunching all the uploaded images into the size you want to use only once. Like a shortcode that can resize and crop an image from your media library to whatever dimensions you tell it to:

Right, a shortcode (argh!) to dynamically resize an image. Fair enough, a lot of premium themes seem to have something similar, but mostly use TimThumb because it’s so simple. However, I’ve created an image shortcode function that resizes and crops images from the media library on the fly using the image_make_intermediate_size function available as early as WordPress 2.5!

Quelle: http://kovshenin.com/2012/native-image-sizing-on-the-fly-with-wordpress/

 
image shortcode function on gist.github.com

Veröffentlicht von

NekoPlayz

#Coder | #Tinkerer | #Gamer - benötigt seine tägliche Dosis Kaffee - sonst ist er nicht einsatzfähig ;) - begeistert sich für Filme, Serien, Musik, Games, Lesen, Codeschnipsel und vieles mehr... Zu finden auf Twitter unter @BheimseinBlog und @NekoPlayz

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.