Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS

Saving External Images


Reply

2 Posts   1119 Views

Avatar
SamTheJarvis

21 May 2011 at 11:45am Community Member, 24 Posts

Hi Guys,

I'm wondering about a bit of functionality whereby a user types in an external URL of an image and silverstripe will retrieve this image, put it in a folder like /assets/sites/{domain} and create a record for it in the database.

Any help would be awesome.

Thanks.

Avatar
danzzz

23 May 2011 at 10:48pm Community Member, 175 Posts

hi

I think I would put the relevant code into the onBeforeWrite() function of the dataobject where you ask for the image url.
I just googeled for getting images with php, check this: http://www.edmondscommerce.co.uk/php/php-save-images-using-curl/
And this link should be also usefull: http://silverstripe.org/data-model-questions/show/12823

daniel