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.

Releases and Announcements /

Latest news about the SilverStripe software.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

2.3RC4 -> Undocumented backwards incompatiblity with Image->URL


Reply


5 Posts   2184 Views

Avatar
Fuzz10

Community Member, 787 Posts

22 February 2009 at 5:56am

For http://www.fahrenheitstore.nl I use GD quite a lot to re-size images and add watermarks to them.

After upgrading the site to 2.3rc4 , the watermarks stopped working ..

It seems the value of the URL property of the Image class has changed.. From 2.3 on , it returns a relative path instead of a full absolute address. This breaks backwards compatibility.

I can't find anything about it in the docs (maybe I'm not look in the right places), but before I post a ticket, can anyone confirm this behaviour for me ?

Testcase :

2.2.3

class Bla extends Image {
..
return $this->URL;
..
}

returns : http://www.blabla.com/assets/bladiebla/bla.jpg or something like that..

Where in 2.3 it returns just

/assets/bladiebla/bla.jpg

Thanks !

Avatar
Ingo

Forum Moderator, 801 Posts

24 February 2009 at 8:34pm

There was indeed some tricky deprecation for Image->URL. Relevant changesets from 11 months ago:
http://open.silverstripe.com/changeset/51251
http://open.silverstripe.com/changeset/51471/

$image->URL should call $image->getURL(), which gives you a relative link in 2.3 - so not sure why this fails...

Did you subclass image, and perhaps added a $db property called URL?

I've also found out that File->getURL() actually returns the absolute URL - this inconsistency needs to be fixed, I've opened a ticket: http://open.silverstripe.com/ticket/3600

Avatar
Fuzz10

Community Member, 787 Posts

24 February 2009 at 9:04pm

>$image->URL should call $image->getURL(), which gives you a relative link in 2.3 - so not sure why this fails...

Well yeah, that is indeed what it does.. ;-) But in 2.2.3 , it returned an absolute link .. I think it should be noted in the upgrade-documentation that this is going to happen , because it took me quite some time to figure out why my site got killed.. That is all.. ;-)

Avatar
Ingo

Forum Moderator, 801 Posts

24 February 2009 at 9:57pm

Lol, yeah got myself confused there ;) Added a note to http://doc.silverstripe.com/doku.php?id=upgrading:2.3.0

I should've marked the original commit as "API CHANGE", in which case it wouldn't have gone unnoticed in compiling the upgrade warnings.

Avatar
Fuzz10

Community Member, 787 Posts

24 February 2009 at 10:02pm

Cool...

thanks !