256 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Has been part of the Envato Community for over 5 years
  • Won a competition
+5 more
der says

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!

1182 posts
  • Has been part of the Envato Community for over 4 years
  • Has sold $40,000+ on Envato Market
  • Has been a beta tester for an Envato feature
  • Has collected 50+ items on Envato Market
+5 more
Smartik says

Another good script. Thank you for sharing. Will give it a test when I will have free time. ;)

296 posts
  • Has been part of the Envato Community for over 2 years
  • Sells items exclusively on Envato Market
crossroad says

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?

256 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Has been part of the Envato Community for over 5 years
  • Won a competition
+5 more
der says

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.

296 posts
  • Has been part of the Envato Community for over 2 years
  • Sells items exclusively on Envato Market
crossroad says

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?

256 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Has been part of the Envato Community for over 5 years
  • Won a competition
+5 more
der says

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…

296 posts
  • Has been part of the Envato Community for over 2 years
  • Sells items exclusively on Envato Market
crossroad says

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
256 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Has been part of the Envato Community for over 5 years
  • Won a competition
+5 more
der says

@crossroad I’ve spotted this error and fixed it a while ago. Re-download the code from the latest commit.

It’ll work ;)

296 posts
  • Has been part of the Envato Community for over 2 years
  • Sells items exclusively on Envato Market
crossroad says

Yes, it works now, thanks. Have you checked it there are any other bugs? :)

256 posts
  • Elite Author: Sold more than $75,000 on Envato Market
  • Has sold $125,000+ on Envato Market
  • Has been part of the Envato Community for over 5 years
  • Won a competition
+5 more
der says

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.

by
by
by
by
by
by