Grab and Save an Image Dynamically from Vimeo for Silverstripe CMS

There is input field for a Video ID in Silverstripe CMS. This Video ID is then used with Restful Service to get the XML of its associated data. One piece of data is a URL to the video’s thumbnail.

What we try to do is that to get the image from this URL, save it to my assets/uploads and finally save it to the database as a has_one image.

The basic idea here is to have a field that you input a Vimeo video ID into and it will grab the video’s thumbnail. If you save the object it will update the image from Vimeo.

You could use the same saving code for files as well as they require the same fields.

Here’s the DataObject that has_one image eg. a page of with a thumbnail:

Leave a Reply

Your email address will not be published. Required fields are marked *

CAPTCHA