The case AGAINST phpThumb
I'm really, really, really tired of phpThumb:
>> Time wasting
trouble-shooting and maintenance.
>> Hard to remember parameters.
>>
Security issues to the moon... //Turn off the debugger!
>> Performance is 100% dependent on
CACHING.
http://mrphp.com.au/blog/image-cache-using-phpthumb-and-modrewrite#.UvvIheyC3JE
// Killing the server when dealing with hi-res photo albums.
Front-end Options...
Browser Resizing (width), CSS (max-width) and JavaScript magic are great. With HTML5 and responsive websites we get more options:
<picture>
<source type="image/webp" src="image.webp" />
<source type="image/vnd.ms-photo" src="image.jxr" />
<img src="fallback.jpg" alt="fancy pants">
</picture>
http://mobile.smashingmagazine.com/2013/05/10/how-to-avoid-duplicate-downloads-in-responsive-images/
>> But for hi-res desktop photos we need something more than what the front-end can offer...
Good News
4 years, 3 months ago eddygroove and Alik came up with the best solution ever.
-->
http://forums.modx.com/thread/42541/tip-basic-thumbnail-solution-using-thumb-instead-of-tv-image#dis-post-246179
This should be COMMON SENSE:
You're better off always generating thumbnail versions of images on upload/creation instead of trying to serve them through php scripts on-demand.
http://stackoverflow.com/questions/9346298/what-is-the-best-to-use-phpthumb
You should ideally not rely on phpThumb generating images on the fly, for each pageload your server is having to manipulate images as well as parse PHP and grab data from MySQL; image manipulation is a serious CPU hog and should be done only where absolutely necessary, otherwise create images which are the correct size and link to those directly.
With that said, you can alleviate the load by caching the generated images either on the server by tweaking phpThumb or by making use of a Content Delivery Network such as MaxCDN, Amazon Cloudfront or even CloudFlare which is free.
Hope that answers your question.
http://www.webhostingtalk.com/showthread.php?t=1095768
Implementation
KCFinder is currently the Image-uploader MODX uses as standard for TV's and TinyMCE dialogues. It's awesome as the UI is both Simple and Beautiful. It generates Thumbnails in assets/.thumbs/images of photos greater than 150px in size.
I have made use of this solution 100%
>> ThumbURL as TV output-widget. SEE http://snag.gy/TY2yp.jpg
tmplvars.format.inc.php line 59 after case 'image':
//mrhaw
case 'ThumbURL':
$images = parseInput($value, '||', 'array');
$o = '';
foreach($images as $image){
if(!is_array($image)) { $image = explode('==',$image); }
$src = $image[0];
if($src) {
// Make thumbnail URL
$o .= str_replace('assets/images', 'assets/.thumbs/images', $src);
}
}
break;
>> mutate_tmplvars.dynamic.php line 90 (Widget Parameters), after image param add new line:
widgetParams['ThumbURL'] = '';
>> mutate_tmplvars.dynamic.php line 386, after image option add new line:
<option value="ThumbURL" <?php echo ($content['display']=='ThumbURL')? "selected='selected'":""; ?>>ThumbURL</option>
>> ManagerManager-widget for Image Previews "showimagetvthumbs"
http://forums.modx.com/thread/88252/modx-evolution-1-0-13-rc2---need-help-with-tests?page=8#dis-post-489573
>> PHx Custom-Modifier Snippet for the front-end phx:thumb
http://forums.modx.com/thread/89082/thumbnail-with-news-post#dis-post-489858
// Not necessary if ThumbURL widget is used.
Conclusion
If you still think phpThumb is a better solution, fine - Freedom! If you think I am right please share, discuss and link to this thread!!
BONUS TIP We can now cache $_GET parameters (?picture=001) in MODX EVO
[ed. note: mrhaw last edited this post 10 years, 1 month ago.]