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.

Data Model Questions /

grabbing logos from URL and adding with imagefield?


Reply


2 Posts   1165 Views

Avatar
danzzz

Community Member, 175 Posts

7 April 2011 at 10:35pm

Edited: 07/04/2011 10:38pm

hi

I have a dataobject with this relation:

static $has_one = array(
'logo' => 'Image',
);

So with this I can add a logo in the backend ...
In my case I would download the logo from an other site an upload it on my site ...

But how it's possible to add a logo automaticly if I know the URL to the image -> dowload the logo and add it with imagefield?

I think it's easyier to not use an imagefield in this case and just link to the logo URL, right?

thx

Avatar
swaiba

Forum Moderator, 1799 Posts

7 April 2011 at 10:48pm

weeelllll - you can always just insert HTML into your content to do the sort of thing you are asking.

the real benifit of uploading it to silverstripe assest (which is what that does) is that the image can be manipulated (into thumbnail, or cropped, etc) and is then stored in resampled (a "cache") which greatly speeds up page load - at the same time as giving your users more "simple" control over these things. A nice thing of SS3 I am looking forward to is versioned assests - out of the box - but it'll only be with using the technology not taking "shortcuts".