CodeIgniter Forums
image_lib improvement: keep resource for several actions (better quality) - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Development (https://forum.codeigniter.com/forumdisplay.php?fid=6)
+--- Forum: CodeIgniter 3.x (https://forum.codeigniter.com/forumdisplay.php?fid=17)
+--- Thread: image_lib improvement: keep resource for several actions (better quality) (/showthread.php?tid=72217)



image_lib improvement: keep resource for several actions (better quality) - omarboti - 11-22-2018

Hello. (Spanish native speaker; sorry about my english)

I've been involved in a project where i should put many words on a background image. Also, sometimes it has to be saved to a file on server and someother it was created on the fly and returned (no saving on server).

So i had to make a modification on image_lib library to keep the resource between different text_watermark method invokes; added a property option for the flag and a private property for the image resource. Also a method to get that resource. And finally modified the text_whatermark method so it could take -at the beggining- the resource if flag and resource were set, and returning true without destroying it before leaving.

That make me achive two goals:
-improve result image quality
-being able no to save unnecesary files

Maybe this kind of improvement can be applied for the others methods (overlay_watermark, crop, resize...).

Hope it could be considered for future versions.

Omar


RE: image_lib improvement: keep resource for several actions (better quality) - InsiteFX - 11-23-2018

You should never modify a CodeIgniter System file!

You extend the libraries and add what's needed.


RE: image_lib improvement: keep resource for several actions (better quality) - omarboti - 11-23-2018

(11-23-2018, 04:52 AM)InsiteFX Wrote: You should never modify a CodeIgniter System file!

You extend the libraries and add what's needed.

Yes... i should never do it... but i was in a rush, and also i'm suggesting an -intresting?- improvment on the library, for implementing many watermarks keeping image resource instead of saving each time (and loosing quality).

Cheers