phpThumb Integration -- Need some advice
PermalinkI've accomplished integration so far by simple adding a function, frame, to the download_file.php controller. I'm using the download_file.php controller because this is what the file chooser passes to tinyMCE when you choose an image. So then tweaking the URL a bit I get what I want.
For example the URL /index.php/download_file/-/frame/7|brush_06|180 would put the 'brush_06' frame on the image and size it down to 180 pixels width. The frame function parses the url and passes it off to phpThumb which outputs the image. It all works great but I'm still hoping to make it even easier for the end user.
I've been searching around for other possible points for integration and came across 'Files Attributes' in the file manager. I don't have a very clear understanding of the file helper or however all this works but:
Is there a way to access these attributes from like the download_file.php controller?
If so then perhaps a better way to integrate this would be for them to specify the attributes from the dashboard rather than tacking them onto the URL from tinyMCE?
or... Maybe I need to hack up tinyMCE instead to generate the URL easier?
I also thought of making a block or something but then I wouldn't be able to use images inline with the content. (float left, etc)
I'm really open to suggestions and advice from some of the more experienced users of c5's inner workings. I might be taking the complete wrong approach.
Thanks!
=D

I've seen that c5.3 sometimes loads pictures using download_file. If it would load all the pictures using download_file it would be very easy to do. Add some file attributes and check them in downoad_file - done!
But as already someone mentioned, it's not always a good idea to load pictures using this script. It might work better if there was some kind of cache management (not talking about the cache library which has been around since 5.2). Adding expires tags and similar stuff is someting essential.
---
Yes, download_file would work but I'm avoiding download_file at the moment whenever I can...
Maybe we should first "fix" the download_file headers problem.
http://www.concrete5.org/community/forums/usage/concrete_5_3_no-cac...
He also tries to get rid of download_file...
Thanks Remo for the input. I know that phpThumb has a decent caching system and I use it heavily on other non-c5 sites so I'm not too concerned about that.
Can you give me some help on how you pull those attributes? I can't find any examples or documentation on it.
=D
I'm talking about the browser cache and how you can influence it using some fancy headers.
If you load something like thishttp://server/background.jpg it gets cached by the browser, but if you do thishttp://server/download_file.php/background.jpg... it doesn't unless you carefully set some headers..
1. get file object (File::getById...
2. get file version object ($file->getVersion..
3. get attribute $fileVersion->getAttribute
but you might want to check the code on your own for this..
Thanks
1. Does the url change?
2. How does phpThumb get called? mod_rewrite?
3. What does FireBug tell you about the headers?
...
http://caribbeanfuse.com/beta.php...
the url is something like this :http://caribbeanfuse.com/360x220_img_resnl/juice/pics/50_364325083....
phpthumb is called via a 404 error handler.
in mozilla firefox is working fine...just in IE I have problems
I never read anything about 404 & caching because caching a 404 page isn't important. It should never happen.
Can't help you with that but I suggest trying a real rewrite. In my case, the cache also doesn't work with Firefox... It looks like it reloads all the pictures an gets a 404 for almost every file. Everything is red in firebug...
Can you help me do a rewrite rule to the url I gave as an example?
Thanks a lot for everything
=D
that redirect is a bit silly as it redirects everything to that php script. It has some basic 404 error handling functions but that's probably not enough in a lot of situations..
Also c5 uses a similar rewrite meaning that you can't use it, otherwise c5 won't work..
You have to modify the script and the rewrite in order to use it!
The module lets you define profiles and call them via a theme function or other modules. Presets can contain scaling, cropping, and once the image is processed it is cached. This is great when you want to use the image in multiple locations.
It doesn't include cropping, but myself and others in the community have created an improved helper that does offer this as well (and it will do the caching just the same):
http://www.concrete5.org/community/forums/customizing_c5/getthumbna...
Cheers,
Jordan