0

I am making an app where a user can add a bunch of websites and I will pull the Favicon for that website and store it in a tiny little imageView. I am using Firebase. Regarding the actual pulling of the Favicon.

I have found that adding /favicon.ico to the end of a URL shows you the Favicon. I also found this SO post.

But my question is more on how to best deal with getting the image for all users overall, not for just one user. My ideas are:

  1. For every user for every website pull the favicon and store on Firebase each time.

  2. As users add websites create a list (maybe a set) on Firebase (don't know how yet) and if it has already been added don't re add it just pull from that one.

My concern is that if 100 people (hopefully) were to all add like google.com that is 100 uploads of the same exact image, and that feels like a waste.

Can anybody recommend a best practice way?

Thank you.

Community
  • 1
  • 1
RubberDucky4444
  • 2,330
  • 5
  • 38
  • 70
  • I don't know if is the best practice but maybe you can create a child named `favicons` and store there all the images. Then after a user add a new website just check if the favicon (naming the image as the site will be great to index it) exists, if not, upload and assign the id to the user, if exists just assign the already id to the user. – Gerard Cuadras Dec 22 '16 at 10:54
  • @GerardCuadras I haven't used Firebase for a while, can I make a a public child in Firebase that all private accounts can access? – RubberDucky4444 Dec 22 '16 at 20:12
  • Yes of course, just set any rule to check that private accounts can access. You can check that they are logged in or have an account. Check [this](https://firebase.google.com/docs/database/security/securing-data?hl=en) doc – Gerard Cuadras Dec 23 '16 at 07:08
  • As an aside, it is somehow unsafe to blindly get `/favicon.ico`. I suggest you to read this question: http://stackoverflow.com/questions/21991044/how-to-get-high-resolution-website-logo-favicon-for-a-given-url/22007642 – philippe_b Dec 28 '16 at 08:50

0 Answers0