107 posts Too Much is Never Enough
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Exclusive Author
  • Bought between 1 and 9 items
  • Referred between 100 and 199 users
  • Has been a member for 3-4 years
premitheme says

Hi there,

Any body tried to replace timthumb with image_resize() function? What’s its pros / cons. Can we depend on it? and is it has the same timthumb issues (premissions…etc)?

I’m going to try it myself but wanted to see what do you think guys.

Thanks,

369 posts
  • Envato Studio (Microlancer) Beta Tester
  • Sold between 10 000 and 50 000 dollars
  • Most Wanted Bounty Winner
  • Bought between 10 and 49 items
  • Exclusive Author
  • Has been a member for 3-4 years
kaaz says

Timthumb : resizes on the fly
image_resize() : resizes – server side

988 posts It's in the pipeline!
  • Elite Author
  • Exclusive Author
  • Europe
  • Has been a member for 5-6 years
  • Bought between 100 and 499 items
  • Referred between 200 and 499 users
  • Envato Studio (Microlancer) Beta Tester
+2 more
purethemes says
107 posts Too Much is Never Enough
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Exclusive Author
  • Bought between 1 and 9 items
  • Referred between 100 and 199 users
  • Has been a member for 3-4 years
premitheme says
purethemes said
vt_resize FTW https://gist.github.com/1367237

Thanks will give it a try

3424 posts
  • Football Contest Participant/Runner-up
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Community Moderator
  • Bought between 100 and 499 items
  • Referred more than 2000 users
  • Has been a member for 4-5 years
+5 more
sevenspark Volunteer moderator says

Personally I think the best option at this point is WordPress’s built-in resizer. It has its limitations, but it also has a lot of advantages (security, no extra configuration, no need to keep up with the latest version since it’s part of the core). I’m going to save myself the headache of using third party resize scripts in the future :)

107 posts Too Much is Never Enough
  • Elite Author
  • Sold between 100 000 and 250 000 dollars
  • Exclusive Author
  • Bought between 1 and 9 items
  • Referred between 100 and 199 users
  • Has been a member for 3-4 years
premitheme says
sevenspark said
Personally I think the best option at this point is WordPress’s built-in resizer. It has its limitations, but it also has a lot of advantages (security, no extra configuration, no need to keep up with the latest version since it’s part of the core). I’m going to save myself the headache of using third party resize scripts in the future :)

Thank you for such valuable opinion sevenspark! But do you mean image_resize() function? or vt_resize (as it uses wp’s built-in resizer)? Just want to know if anobody has any issues with the built-in function.

The only differeance in results I can see that TimThumb can output the image in bigger size if you want, but wp’s built-in function (and vt_resize) uses the max height/width only. But what about server requests for example?

1999 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Author had a File in an Envato Bundle
  • Has been a member for 5-6 years
  • Author had a Free File of the Month
  • Won a Competition
  • Bought between 10 and 49 items
+4 more
bitfade says
premitheme said
But what about server requests for example?
Timthumb and similar solutions serve images using php which is just a useless waste of servers resources. WP standard behaviour is to resize once and serve the static image directly via the webserver (apache/nginx/whatever)
28 posts
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 3-4 years
Frenki says
bitfade said
premitheme said
But what about server requests for example?
Timthumb and similar solutions serve images using php which is just a useless waste of servers resources. WP standard behaviour is to resize once and serve the static image directly via the webserver (apache/nginx/whatever)

exactly. Few weeks ago i developed WP site for one company, they didnt want to spend much money so instead of creating theme from scratch i told them to buy some template here and ill just customize it for them. Template was using thimthumb and after 2 days of working, they got email from hosting company that they were using to much server resources and their site got suspended…Even tho they had like 3000 visits. After i checked logs, i saw that timthumb script was using 70% of resources… so i just replaced it with WP image_resize and now images are made once you upload it and served as static.

So if u plan on doing site with much or some traffic, i say go with image_resize.
3424 posts
  • Football Contest Participant/Runner-up
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Community Moderator
  • Bought between 100 and 499 items
  • Referred more than 2000 users
  • Has been a member for 4-5 years
+5 more
sevenspark Volunteer moderator says
premitheme said
sevenspark said
Personally I think the best option at this point is WordPress’s built-in resizer. It has its limitations, but it also has a lot of advantages (security, no extra configuration, no need to keep up with the latest version since it’s part of the core). I’m going to save myself the headache of using third party resize scripts in the future :)

Thank you for such valuable opinion sevenspark! But do you mean image_resize() function? or vt_resize (as it uses wp’s built-in resizer)? Just want to know if anobody has any issues with the built-in function.

The only differeance in results I can see that TimThumb can output the image in bigger size if you want, but wp’s built-in function (and vt_resize) uses the max height/width only. But what about server requests for example?

Sorry for not being more clear. I’m suggesting using the standard WordPress solution as bitfade described. Basically, the process of defining image sizes using add_image_size and then grabbing the appropriate image size using WordPress’s core functions, like get_the_post_thumbnail.

The downsides are several, but outweighed by the positives in my opinion:

1. You can’t scale the image larger than its original size. (I think if you have to, just let the browser do it).

2. Every image will have a copy in every size, whether it needs it or not (if your size choices are well thought out, I don’t think it’s much of a problem – and server space is less expensive than server processing power).

3. If you add or alter an image size in the future, you’ll need to regenerate those thumbnails with a plugin (a little annoying, hopefully they’ll be add some core functionality to do this in the future).

The positives:

1. You’re using core functionality. That simplifies things.

2. Like bitfade said, you’re processing once and serving static files from the server; that’s more efficient in the long run (and easier on your server).

3. No security holes (to my knowledge – clearly, timthumb has had vulnerabilities exploited in the past).

4. No extra configuration for customers (chmods freak non-tech people out)

5. Functionality is automatically upgraded with Core releases (if you use a third party script, you have to upgrade when they upgrade – dependencies can be bad). Also, you can expect the functionality to continue to work with future releases, whereas third-party scripts may lose compatibility and may or may not continue to be supported.

6. Coding this way would make your theme more compatible with plugins that affect image thumbnails (potentially).

Having worked with WordPress for a while now, my opinion is that diverging from the standard WordPress functionality with third party replacements often creates more problems than it’s worth. Generally, working within the system creates fewer headaches for everyone. :)

Hope that explains it (my opinion) better!

Chris

1999 posts
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Author had a File in an Envato Bundle
  • Has been a member for 5-6 years
  • Author had a Free File of the Month
  • Won a Competition
  • Bought between 10 and 49 items
+4 more
bitfade says

A nice solution would be to use mod_rewrite: serve if images exists, generate it if not.
downside is, adding rewrite rules can sometime be tricky if buyer already has some of them

another one is to use a custom 404 wordpress page to do the same thing, it doesn’t require mod_rewrite but it returns a 404 header when generating the image.
though, almost all browsers would display it anyway.

by
by
by
by
by
by