This document should describe a possible addition to the joomla code to enhance professional use of thumbs and image previews (that can be used everywhere, especially in content (lists))
2. What is the current issue?
A lot of sites display smaller image previews of bigger images, as in some examples cases: blog lists, articles lists, news lists, database displays, galleries, contact lists, media management, and so on and on..
In too many cases (esp. joomla) this is still done with simple html resizing in stead of resizing the image itself!
Sometimes this leads to (home)pages beyond several MegaBytes! This is not professional and generates a bigger bandwidth load than needed.
Several components and other extensions have already written their own code to overcome this, but not only is this redundant and thus not so good in performance and such, but also it doesn't allow much freedom and parametrization to the administrator (see below).
3. What are the proposed improvements?
What needs to be done is a code that reads the image file, resize it and (preferably) cache it into a smaller file.
I guess this is best to be added in the joomla library, but maybe other people know better where this fits (in a joomla system plugin or something else)..
Remark: Why only resizing / thumb?
In this accepted white paper about Media Manager improvements, I talk about a more general Image class outside media manager (that can be used by the media manager too), but maybe the most important and developer welcomed thing is to start with an image resize or thumb class!
Other image functions would maybe not be used as much and take up too much php code. (Maybe this would then rather belong in another class?)
It would also take a much longer time to agree and develop. So, let's start with just the most important feature.
At teh very least this forum topic above illustrates already the interest in this feature for Media Manager (and some posters for other uses too).
4. Possible uses
- By developers for several things in joomla itself (such as the media manager, several "lists" such as blog views, etc..), in extensions, etc..
- Another way to use this implemantation is for a site administrator not to pay attention anymore to his/her editors in regards to image sizes. I am sure some guidelines and help manuals are written for employees and other site editors about what and how to upload images. So, with a certain implementation of this "Thumb" feature one has less trouble on that end, i.e. can just let these editors upload any image (size) they want, and generate the right dimensioned images on teh fly for the article itself. Though the effect is exactly the same as above, it's not about justs lists and galleries and such anymore, but about images on the article pages and other content pages themselves. (Thumb is a bad name in this case, but well..)
- One might also think about the positive results on the environment, since joomla is a wide used system, several TerraBytes of bandwidth (and thus electric consumption (client and server!)) can be saved if this is applied!
There is no negative effect to be expected (though several positive :-) ).
6. Some requirements, possible implementations or parameters:
- Cache system (Is joomla cache sufficient for this? a longer file "lifetime" might be expected)
- Allow different "ways" to "resize" (crop from middle or left upper corner, ratio-resize inside box, auto generate height ratio wise, etc...
- Library independance: gd_info, Imagemick, etc.., possibly also maybe a joomla php written one? Let the admin choose.
Possibly start with the standard enabled php library (=gd_info) and wait for the demand to take on others?
- Any library used should at least be able to handle these 3: gif, png, jpg
- Make the cache filenames recognizable. Reasons:
- Easier to understand for other developer
- Easier for anyone (admin/developer/end-user/Google) to determine what is represented on the server or with the URL generated from it, should any of these happen to come across the filename
- To optimize derver download and server-load and server space, optionally allow to resize images only as a multiplication of a fixed predefined amount of pixels (e.g. in blocks of 50 px, you will only get images with sizes (width or height) of 50, 150, 200, 250, .. That's easier on the cache and everyhting in between is close to nihil improvement (as anyone sees fit by the choice of block)
http://groups.google.be/group/joomla-de ... 86b84f1ee0
http://groups.google.be/group/joomla-de ... a2246a77e2
http://joomlacode.org/gf/project/displa ... m_id=12528
8. Some code implementaion already.
It's only for gd_info though and needs some work, but it wokrs already!
You can see this code working on this site's homepage. (It's cropped from the middle into a 110x115 box)
I wonder if it is permitted/advised to ask questions about this code in this topic already? Could someone answer me that.