is their a way I can use saveIconFromUploadedFile and have it save as a png instead of a jpg?
info@elgg.org
Security issues should be reported to security@elgg.org!
©2014 the Elgg Foundation
Elgg is a registered trademark of Thematic Networks.
Cover image by Raül Utrera is used under Creative Commons license.
Icons by Flaticon and FontAwesome.
- iionly@iionly

iionly - 0 likes
You must log in to post replies.Short answer: "no". The "jpg" extension is hard-coded and the Elgg core code is written to create jpg files.
Longer (incomplete) answer. "maybe". The creation of the icon files is not done completely within saveIconFromUploadedFile() but there is a cascade of functions that are involved (the functions are split to be able to deal with different parts of the work separately to be able to reuse them depending on the requirements in different situations). The function saveIconFromUploadedFile() calls the functions saveIcon() and within this function the plugin hook "entity:<type>:save", "<entity_type>" is triggered (for example for creation of icons for entities of type object it would be "entity:icon:save", "object"). This seems the only point in the process where you could interrupt Elgg with dealing with the icon creation when registering a callback function for this plugin hook. But then you would have to implement your own code that creates the icon file within this callback function. Additionally, there might be other issues arise then if the icon files are saved as png and not jpg when Elgg tries to output the files expecting it to be jpg files and therefore might serving them with the wrong mimetype which could cause trouble with displaying the images in the browsers (I think Chrome is very sensible with regards to filetype/mimetype).