Open-event-server: Maintain the extension of uploaded image

Created on 28 Aug 2016  路  13Comments  路  Source: fossasia/open-event-server

As of now, irrespective of the type of image (jpg or png) added to the event while creating it, the exported zip of the event contains only png files.
For example if the uploaded image is test.jpg, the zip contains test.png.png
This is a blocker as simply renaming .jpg files to .png causes their corruption and hence the android build on the server throws an exception.
As I can not determine the original format of image from the zip on the app generator server, this should be fixed while exporting the zip.

bug

All 13 comments

@the-dagger this is not just a change in format.. The image is converted properly.
Moreover don't use the background_url or profile_avatar links for image. Instead you will see large, thumbnail, etc links for image which are resized and in jpg format with proper compressed size. Use that.

@SaptakS I'm using
"background_image": and "logo": in event.json for fetching the images.
But it gives me a libpng error while compiling the app saying that the file is not png.

AAPT err(Facade for 1979286270) : No Delegate set : lost message:libpng error: Not a PNG file

I will check for the logo but as of background_image, don't use that. I guess there will be fields large, thumbnail, icon, etc. Use those. They should be in proper format.

Moreover the logo and background_image are opening perfectly for me in website, browser, normal desktop. I will check again though but it shouldn't be a problem..

@SaptakS I checked, there is no other field which contains reference to the logo or background image in the event.json.

@aviaryan Could you please provide input how the recent changes of @SaptakS effect the API, export JSON and image files?

the exported zip of the event contains only png files.

@SaptakS Can you confirm this? As discussed elsewhere png are not suitable for photos and have a large size if those images have lots of details and colors.

There is plenty of information online about this. Please keep jpgs for photos as mentioned before.

Unfortunately PNG-24 files will still be much bigger than JPEGs, GIFs and PNG-8s, so you still need to consider if you really want to use one.

Even though PNG-24s allow thousands of colours while having compression, they are not intended to replace JPEG images. A photograph saved as a PNG-24 will likely be at least 5 times larger than a equivalent JPEG image, with very little improvement in visible quality. http://stackoverflow.com/questions/2336522/png-vs-gif-vs-jpeg-vs-svg-when-best-to-use

@aviaryan Could you please provide input how the recent changes of @SaptakS effect the API, export JSON and image files?

When a photo is uploaded, the photo is first saved locally, then optimized/converted and then it is uploaded to S3 cloud. So API, export etc now links to the new image, not the one uploaded by the user. I don't think this creates any issues in the API/Export/Import part.

@mariobehling we are keeping jpgs for images only. The PNG that is uploaded is the temporary file and is not used anywhere. Croppie.js converts and saves it as PNG temporarily. But after that all the images are resized, re-scaled and converted to JPG. So the image to be used is in JPG.

@aviaryan according to @the-dagger the fields large, thumbnail, icon fields are not present in the API/Import/Export part which are the new resized and re-scaled images. Could you please check that?

@aviaryan according to @the-dagger the fields large, thumbnail, icon fields are not present in the API/Import/Export part which are the new resized and re-scaled images. Could you please check that?

Yes the large, thumbnail and icon fields haven't been added to the Event API. I will send a PR for it.

@aviaryan Same thing needs to be done for the user profile and speakers as well. Please check the DBs to get a better idea.

@aviaryan Just to be sure, we are all on the same page: The API should only offer the final - actually used - picture on the server. No need to offer the original and other versions in the API/JSONs for the generators.

Or let me know, if I am missing something.

I'm handling this at the app-generator server.
So closing this for now.

Was this page helpful?
0 / 5 - 0 ratings