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

1287 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. ;)

306 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?

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

306 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?

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

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

306 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? :)

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

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by