2.9

JImage Rewriten

Code improvement : Images, Files and Upload Classes

The php classes managing the files has been entirely rewritten.
It is now clean and consistent !
Now, only one helper file is handling all the work for upload, thumbs, :
HelperFile : (helpers/file.php)

The following files has been removed :

classes/file/file.php
Has been renamed in a helper, because it is a static class, so its place is in the helpers.

classes/file/upload.php
Has been merged inside HelperFile. It still does the same job with few improvements at the level of the caller.

classes/images.php
Has been totally removed and the work is left to the JImage native class of Joomla!
We don't need anymore with the actual version of Joomla!

classes/image/image.php
Has been removed because it was an empty class file.


A new important function appeared in the item controller: updateFileField()
It manages the uploader call, manages the file / thumbs deletions and update the image value field in the database in only one static call.



REVIEW YOUR FORKS !
In case you have forked and called one of those classes on your forks, you need to update your code !

Make a search in your forks about thoses classes :

  • [Xxxx]ClassFile
  • [Xxxx]ClassFileUpload
  • [Xxxx]ClassImage
  • [Xxxx]Images

Entry point

[Xxxx]
ClassFile::returnFile('db');

becomes:
[Xxxx]HelperFile::returnFile();



Controller::postSaveHook()


$model->_upload('photo', array(
'image/bmp' => 'bmp',
'image/gif' => 'gif',
'image/jpeg' => 'jpg,jpeg',
'image/png' => 'png')
, array(
'rename' => '{ALIAS}.{MIMEXT}'
)
);

becomes:

self::updateFileField($model, 'photo', array(

'rename' => '{ALIAS}.{MIMEXT}'
));



I jumped and started to work on a demo component... but 2 days later this demo component became the real component. I just showed today the end result to my customer and he turned to me and said... "this is more than I expected"... All of this is because Cook did cut about 70% of my work and provided me more ways to improve the usability of the component. The end result was 17 tables all related between than to generate a full dashboard for the travel agents. Thanks for Cook developers for such great tool. This component would not be possible to be done at short time with all the features in it
Griiettner (Forum)  

Get Started