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.

Archive

Our old forums are still available as a read-only archive.

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

new ImageField('Banner_Image') point to another directory in the Assets Folder


Go to End
Reply

10 Posts   4821 Views

Avatar
Todd

3 May 2008 at 6:25am 31 Posts

Hi Everybody!!!

On to a new project, so more questions!

I wish to upload banners via the ImageField('Image') class to a directory that I define, like ../assets/Uploads/Banners

How do I do this?

Thanks,

Todd

Avatar
Wietse

27 May 2008 at 5:28am Community Member, 1 Post

According to the PHP IDE "Zend", ImageField has the following constructor arguments:
new ImageField(
string $name
string $title=null
int $value=null
Form $form=null
string $rightTitle=null
string $folderName='Upload'
);
Curiously enough, when I'm trying to fill out all of these fields, Zend's tooltip indicates that $form is being skipped.

Anyway, I've tried to manually set $folderName with 6 and 5 constructor arguments, and neither methodes help me to upload images to an alternative directory.

I'd be thankfull for any info about this.

Avatar
Todd

2 July 2008 at 12:16am 31 Posts

It would be great if someone, anyone had some sort of answer to this question. Maybe it is an issue that isn't too important to others, but it would be very helpful to me.

Todd

Avatar
Willr

2 July 2008 at 11:52am Forum Moderator, 5511 Posts

It seems to work for me. For one of my sites ive got "BlogImages" saving into blogimages/ folder

new ImageField("BlogImage", "Image", null,null, null, "blogimages");

Avatar
Todd

5 July 2008 at 6:43pm 31 Posts

Hi Willr,

What version of Silverstripe are you using? I've tried the same thing in v. 2.2 and all it does is upload the image to the "Uploads" directory.

Todd

Avatar
Willr

5 July 2008 at 9:38pm Forum Moderator, 5511 Posts

this is on my site running tags 2.2.1 - http://open.silverstripe.com/browser/modules/sapphire/tags/2.2.1, have to upgrade to the latest some day :P

I have no clue why it would be broken on 2.2.2 You might just need to Debug through FileField.php - The constructor for ImageField should set the folderName. Perhaps theres a bug in that. I'll have I look into this on a upcoming project.

Avatar
Todd

6 July 2008 at 2:55am 31 Posts

Hi Willr,

Is there a link where I can download 2.21?

Todd

Avatar
Willr

6 July 2008 at 12:48pm Forum Moderator, 5511 Posts

There might be a 2.2.1 zip on this site still (find the download link for 2.2.2 and change the URL to 2.2.1 and see if that works) Otherwise you will have to use subversion to checkout http://svn.silverstripe.com/silverstripe/open/modules/sapphire/tags/2.2.1

Go to Top