21278 Posts in 5728 Topics by 2599 members
|
Page:
1
|
Go to End | |
| Author | Topic: | 950 Views |
-
Can't view uploaded Image

31 August 2009 at 6:54am
Hi All.
I'm having a problem with my images, hopefully someone can help.
I added the following in my page.php file under the "class Page extends SiteTree":
public static $has_one = array( 'Banner' => 'Image' );
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Banner", new ImageField('Banner'));
return $fields;
}The banner image uploads, but no picture. When I look at the source html it shows: <img src="/assets/" alt="assets/" />
What am I doing wrong?
-
Re: Can't view uploaded Image

31 August 2009 at 9:03am
Have you rebuilt your database (www.yoursite.com/dev/build) to add the new fields for the image?. Next thing you can check is if you go into your database (with phpmyadmin or similar) and you select the 'Page' table you should see a BannerID column. Check this value - if your upload worked then this should not be 0.
-
Re: Can't view uploaded Image

1 September 2009 at 11:17am
Hi Willr,
I figured it out. I has a .ss file from a previous project that was interfering with the link. Sorry for wasting your time and many thanks for the quick response and help.
Todd
-
Re: Can't view uploaded Image

9 November 2009 at 4:28am Last edited: 9 November 2009 4:28am
Todd, what exactly was in the template file that was messing up your link? I'm having the same problem, but only have one main template (Page.ss) and as far as I can tell not even removing my includes fixes the issue. Thanks
| 950 Views | ||
|
Page:
1
|
Go to Top |



