2

I am working on an iOS app where the users can add description/text when uploading images like Snapchat.

Do they render images and add the text to image so that it becomes part of the image itself or is it shown as a UILabel over the image?

For the 2nd option the text would have to be sent separately to server.

P.S. Just having an argument with Server side programmer and I'm suggesting the 2nd option.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Abdullah Umer
  • 4,234
  • 5
  • 36
  • 65
  • I believe that they will add the text to the image and thus providing a unique image with the text.. I believe this is because they can add the transparent background to the image. – Phorce Oct 25 '15 at 18:21
  • 1
    I do not know the specific process Snapchat uses on iOS, but when a "snap" is received by the recipient, it is purely an image file. There are not multiple image files for a single "snap". So, it would seem that at some point Snapchat compiles all stickers, text, and drawings onto the image. It would be my guess that this occurs on the sender's device once the sender presses "send". I am basing this off the fact that if you have a custom font installed on your phone, any text on a sent image will also use that custom font. – Spencer D Oct 25 '15 at 18:30
  • @SpencerDoak That's true, but it's still possible they are sending the text separately to the server. In general, it all depends on the use cases - do you need to resize the image on the server? Do you need to know the text on the server? Then you have to send them separately or combine both approaches (e.g. send image with rendered text but also send the text separately). – Sulthan Oct 25 '15 at 18:33
  • @Sulthan, of course they *could* send the text separately, but I personally believe it's unlikely. On top of the fact that custom fonts appear on the image (fonts which the snapchat server most likely does not have), we should consider the fact that there are Snapchat "hacks" which allow you to send snaps that contain more than one line of text. Theoretically, you could include as many textboxes on a snap as you want, so if Snapchat sent the text separately, how would they handle this overload of characters? Most database models only allow a fixed number of characters to be stored in a field. – Spencer D Oct 25 '15 at 18:43
  • @SpencerDoak Well, I was not talking only about snapchat. Snapchat probably has no use for the text on the server. All I wanted to say that's it's unlikely the OP has exactly the same use cases as snapchat and that any API discussion shouln't be based on snapchat current implementation. By the way, most database models use VARCHAR for text data and overload is not really a big problem there. – Sulthan Oct 25 '15 at 20:19
  • @Sulthan, ahh I misunderstood your post then. My apologies. Yes, the OP may have a use for the image text to be stored on his end. As for the DB comment, yeah, VARCHAR is used by most databases, but VARCHAR has a fixed length. If the string you are trying to store exceeds the max VARCHAR field's length, this has the potential for no value to be stored and for the database to throw an error (that occurs when a DB is running in *strict mode*). – Spencer D Oct 25 '15 at 23:31

1 Answers1

2

If we check /ph/upload in Snapchat API (last updated 23-12-2013) we can see that you can upload either a photo or a video.

Of course, this is not the latest version (although this is the last documentation I could find) but I am assumming nothing has changed in that regard.

That means the text is inserted to the photo in the mobile client app, not on the server.

In my opinion, you shouldn't base any decisions about your API architecture on Snapchat because it's unlikely you have the same use cases. In general:

  1. Sending data separately is more flexible and makes client implementation simpler.
  2. Rendering data on the client is better for user experience (everything is faster and the user can see the final result) and also it saves a lot of server resources (the more users you have the more this will be visible).
Sulthan
  • 128,090
  • 22
  • 218
  • 270
  • We have finalized to use text separately since the user does not have option to change font type. And the images are retained and the users can later on change the text. So in this situation it's best to save the text separately. Thanks! – Abdullah Umer Oct 26 '15 at 14:07