noobling/Homefornow

Image preprocessing

Closed this issue · 2 comments

There are a few things we have to do with the images before we store them.

  • Ensure its not bigger than a certain size
  • Compress images
  • resize images
  • Only allow files that actually are images. There should be a check to see if file is an image and not just checking the extension but if the file is actually an image.
    Otherwise the images will slow down the entire site. This is just a 2MB image and it slows down page loads considerably.
    http://localhost:3000/service/dashboard/profile/schulist-luettgen-and-damore

I have now addressed these issues

  • The website now rejects images that are above 2MB (although it's rendered as an error page instead of an AJAX response)
  • Images are resized in a Firebase Cloud Function, to keep the website fast
  • The file input defaults to accepting only image files, but if you choose to view "All files" and select something that isn't an image the website will ignore the attempt and reload the page (again, an AJAX response rendering a warning would probably be good here). Technically (as you found out) changing the image mimetype will avoid this check, but only a service will be able to access this page, so we'd have bigger problems to worry about if some random makes it to this page

Issue is confirmed fixed