There are 2 sides to it.
- Prestashop Images storeage
- Pointing to a CDN from Prestashop.
Prestashop only knows about the prestashop/img directory, where it stores all of the images.
From a DigitalOcean Droplet, you can mount a DigitalOcean Spaces just like a file system.
Please check here:
https://www.digitalocean.com/community/questions/how-to-mount-digitalocean-spaces-on-droplets-with-s3fs
Once you have mounted your DO Spaces say as /storage/DO_Spaces. You can simply rename your prestaship/img directory to prestashop/img_backup
and can use a soft link to point img to DO spaces mounted on your droplet.
Assuming /var/www/prestashop is the directory where prestashop is installed.
- go to prestashop directory and create a soft link.
ln -s /storage/DO_Spaces /var/www/prestashop/img
now copy entire prestaship/img_backup to prestashop/img directory
cp -rf /var/www/prestashop/img_backup /var/www/prestashopprestashop/img/
WIthin seconds, you will see your images on your DO Spaces.
2nd step is to be able to view your images from a browser from the DO Spaces and its CDN. For this create a CNAME pointer to your CDN as mentioned above.
On your prestashop computer copy an image to /var/www/prestashop/img directory and check that you can view this file from http://static.mywebsite.com/image.png. You have to make sure that the root of your DO Spaces serves as the img directory.
Now every time prestashop will create an image in the /var/www/prestashop/img directory, it will be automatically copied to the DO Spaces and will be visible from your static URL. You will need to set correct permissions on DO Spaces that all new files become visible to the world.
More on this how to make your files visible or readable is well documented as part of DO Spaces.
https://www.digitalocean.com/community/questions/mount-point-with-spaces
There are some issues with making new files public readable. Here is a discussion. Once you have made your files public these are visible to the world via your static site. So the issue with DO Spaces that you may need to make them public manually so that these are visible to the world is out of the scope of mounting it locally and copying files.
Once these image files are copied to the DO spaces, then these are served just fine. You can configure Prestashop to use a CDN under Advanced Settings. Point to static.mywebsite.com in prestashop configuration. Prestashop will server images from the CDN.