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.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Template Questions /

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

File & Images Problem


Go to End


2 Posts   1855 Views

Avatar
JoeJoe

Community Member, 8 Posts

4 June 2009 at 2:16am

Edited: 04/06/2009 2:17am

Hi silverstripers,
<br >
<br >In my Projectpage.php file i have the following code;
<br >
<br >static $has_one = array(
<br > 'Photo1' => 'ProjectImage',
<br > 'Photo2' => 'ProjectImage',
<br > 'Photo3' => 'ProjectImage',
<br > 'Photo4' => 'ProjectImage'
<br >);
<br >
<br >
<br >class ProjectImage extends Image {
<br >
<br >
<br > function generateSmallimage($gd) {
<br > return $gd->croppedResize(60,60);
<br > }
<br >
<br > function generateLarger($gd) {
<br > return $gd->resizeByWidth(420);
<br > }
<br >
<br > function generateLargest($gd) {
<br > return $gd->resizeByWidth(800);
<br > }
<br >
<br >}
<br >
<br >The ProjectImage class is used to upload the image in different sizes.
<br >Now the problem is when i want to go to the Files & Image section i get an error like;
<br >Fatal error: Class 'ProjectImage' not found in C:\xampp\htdocs\bvlb\sapphire\filesystem\Folder.php on line 104
<br >
<br >I understand that there is a problem with the class name. Now my question is, how can i fix this ? :)
<br >
<br >cheerz,
<br >
<br >Joe

Avatar
Hamish

Community Member, 712 Posts

10 June 2009 at 1:35pm

yikes, formatting fail.

Is ProjectImage in it's own php file? It should be called ProjectImage.php. At the moment, it looks like it is part of Projectpage.php, but it isn't clear because of all those break tags :D