When browsing through the sample data for products, you might have noticed a field, productPhoto, with an exceptionally large amount of seemingly gibberish data. Here is a screenshot from the first product in the collection showing part of the first lines of data for this field:
This data represents Base64-encoded binary data, which, when decoded, is a photo of the product. In this section, we will show you how to cause a web script to display the product photo directly out of the database.
It is important to note that the technique described in this section has advantages and disadvantages over just uploading the photos directly to the images folder of your website's document root. The disadvantage is that this technique produces a larger HTML page, and the photo doesn't render as fast. The advantage is that you have more control over the photos as the database can be secured, and the only way an attacker can access the photo...