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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

upload image as thumbnail


Go to End


6 Posts   1908 Views

Avatar
cbartgu

Community Member, 12 Posts

13 June 2009 at 4:24am

I need to add an option on the silverstripe pages to upload an image thumbnail that is set to a preset size, is there anyway of doing this?

Avatar
Howard

Community Member, 215 Posts

13 June 2009 at 9:14am

Does it need to be saved as a certain size or just displayed as a certain size after it has been uploaded?

Avatar
bummzack

Community Member, 904 Posts

13 June 2009 at 10:31am

When using SilverStripe you usually upload an image in its original format and then define in the template what size it should have. The resized version of the image (in other words: thumbnail) will automatically be created and cached for you.
If you want to make sure, that the users only upload images of a given size, you could probably achieve that by subclassing the ImageUpload field or create custom validators. But as mentioned previously, this procedure isn't really necessary for most use-cases.

Avatar
cbartgu

Community Member, 12 Posts

13 June 2009 at 9:04pm

Thanks for the reply's, yes, the thumbnails need to be a certain size to fit the template without being shrunk so they distort. The users do not really understand how to make the images smaller so would be good if on the page they edit there was a browse button and then they click and upload an image for that page. I need to access the image upload and edit tools but from within the page screen so the image can be edited easily.

Avatar
sorich87

Community Member, 14 Posts

14 June 2009 at 1:32am

This tutorial will be useful for you :
http://doc.silverstripe.com/doku.php?id=imageupload

Avatar
cbartgu

Community Member, 12 Posts

15 June 2009 at 10:26pm

Cheers that was what I was looking for