Image Resizing Function – An Alternative to Timthumb
-
Hey all. I’ve been working hard on updating my plugin the ‘Easing Slider’. A fairly massive update is on the way, and being a slideshow plugin image resizing is always a hot topic.
I had been using Timthumb (like a lot of people), but often spent quite a while looking for a WordPress based alternative. I came across the ‘vt_resize’ function, which initially I felt did the trick, until I found out it wouldn’t upscale images (which was vitally needed). It wasn’t a good enough solution.
So I bit the bullet and decided to come up with my own function. It is heavily based on some of WordPress’s internal resizing functions, except it crops identically to Timthumb itself.
It also supports the upcoming WordPress 3.5 update (an alternative function is used via an ‘if’ statement), which gives us access to some handy image manipulation classes to ease the pain.
So far after a bit of testing it appears to be working very well. I’m really happy with it. It saves the resized images in the WordPress uploads folder, as per usual. This is great, because not only are the images resized but they are static files, which is ideal.
I’ve created a Github page for the function here. It is released under GNU general public license, so feel free to use it as you wish!
https://matthewruddy.github.com/Wordpress-Timthumb-alternative/index.html
There is only one drawback: it won’t work with external images. It’s just too complicated and slow to do so, and probably not worth the effort. If you need to resize an external image, save it to your computer and upload it to the WordPress Media Library. Then use it from there.
That’s it really. If anyone finds any bugs, then let me know and I’ll get them sorted quickly!
Now you’ve no excuse to use Timthumb at all!
- The topic ‘Image Resizing Function – An Alternative to Timthumb’ is closed to new replies.