- Bought between 10 and 49 items
- Exclusive Author
- Has been a member for 4-5 years
- Item was Featured
- Referred between 50 and 99 users
- Sold between 100 000 and 250 000 dollars
- Won a Competition
Hi guys!
Timthumb is no longer allowed as part of Envato’s quality guidelines. Fellow authors have developed excellent alternatives for timthumb, such as Freshizer, BFI-Thumb and Aqua.
I’ve released an image resizing script which I use in my themes. Uses WordPress native image processing functions. It’s compatible with WordPress 3.5+ and below.
The script supports Positional Cropping. Thumbnails are automatically deleted when the original image is removed from the Media Library, and degrades gracefully in case of errors.
Feel free to use it on your projects. Use and abuse under the GPLv2 License.
Get the code here: https://github.com/derdesign/mr-image-resize
Enjoy!
Another good script. Thank you for sharing. Will give it a test when I will have free time. 
Great work 
I have following questions
- Does it first check if the image size exist already? - Does it require specific directory permissions otherwise it will give error? - What’s the advantage of using this over the WordPress native resize function?
- Bought between 10 and 49 items
- Exclusive Author
- Has been a member for 4-5 years
- Item was Featured
- Referred between 50 and 99 users
- Sold between 100 000 and 250 000 dollars
- Won a Competition
crossroad said
Great work![]()
I have following questions
- Does it first check if the image size exist already? - Does it require specific directory permissions otherwise it will give error? - What’s the advantage of using this over the WordPress native resize function?
- Yes, it checks if the image exists already
- No, it uses the same WordPress Uploads directory
- The whole process is abstracted for you. Works on Multisite. Positional Cropping.
Thanks for answering. I couldn’t find any example on how to use it (eg. how to call the function to display an image in the loop). Could you please give an example?
- Bought between 10 and 49 items
- Exclusive Author
- Has been a member for 4-5 years
- Item was Featured
- Referred between 50 and 99 users
- Sold between 100 000 and 250 000 dollars
- Won a Competition
crossroad said
Thanks for answering. I couldn’t find any example on how to use it (eg. how to call the function to display an image in the loop). Could you please give an example?
// Put this in your functions.php
function theme_thumb($url, $width, $height=0, $align='') {
return mr_image_resize($url, $width, $height, true, $align, false);
}
$thumb = theme_thumb($image_url, 800, 600, 'br'); // Crops from bottom right
echo $thumb;
I’ve added the usage example on the github repo, for further reference…
I have added that in my functions.php and I’m using following code in my post and its not working, I have made sure that the image url is correct.
$image_src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), "full"); $image_url = $image_src[0]; $thumb = theme_thumb($image_url, 800, 600, 'br'); echo $thumb;
I’m getting following warning:
Warning: Missing argument 1 for mr_common_info(), called in mr-image-resize.php on line 135
- Bought between 10 and 49 items
- Exclusive Author
- Has been a member for 4-5 years
- Item was Featured
- Referred between 50 and 99 users
- Sold between 100 000 and 250 000 dollars
- Won a Competition
@crossroad I’ve spotted this error and fixed it a while ago. Re-download the code from the latest commit.
It’ll work 
Yes, it works now, thanks.
Have you checked it there are any other bugs? 
- Bought between 10 and 49 items
- Exclusive Author
- Has been a member for 4-5 years
- Item was Featured
- Referred between 50 and 99 users
- Sold between 100 000 and 250 000 dollars
- Won a Competition
crossroad said
Yes, it works now, thanks. Have you checked it there are any other bugs?![]()
I’ve tested it thoroughly and as far as I can tell, no other bugs that I know of.
