Ok, now we have the API ready to start accepting images. We will need to add a new form on the client to accept the files from the user, validate the image, and upload it to the API.
The following screenshot shows how the folder structure has changed:
When we get the info from the API, we store it using entities and, of course, we need a new one for the images. In this case, we will do it a bit differently. We saw that we can store the input filter configuration in the entity; however, for now we will store it directly on the form instead of the entity. This class is more or less the same as the Status
entity; we only have a couple of differences as follows:
public $domain = 'http://zf2-api/images/';
This property will be used in a method that generates the URL of the image. Notice that we are passing the image to the API and storing it on that side of the application, which means that the image should be accessible via a URL to be able to see it. That's why...