MVC, service level and file upload and storage
I am using a layered architecture with Zend Framework.
I have MVC with:
Controllers> (DTO) Services (service layer)> (DOs) Repositories> Persistence
Now I have to handle image galleries. The loading process is the handle on the front, but which part is responsible for generating the thumbs?
Should I store the photos in a temporary folder from the front, passing the temp path to the service that will handle the resize and move the file to the storage server folder?
Or do I have to handle the image resizing / storage process in front and only pass the image url to the service?
The purpose of the service layer is to move the application logic and restrict controllers. But for those cases, I really don't know who is responsible for what :)
Do you have any tips?a source to share
What do you mean by "for these cases"? If your strategy is to put all the logic in the service layer, then I can't seem to find a reason why you should hesitate ...
To create thumbs does not mean a “special” process, so it has to be in a dedicated service as usual. Random information about how images are stored as temporary foreground files should not change this.
The front knows how to load data, what is good and what it is; imaging services can then take the lead and generate any thumbs up.
HTH
a source to share