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

Custom image picker for CMS


Go to End


2 Posts   2060 Views

Avatar
micahsheets

Community Member, 165 Posts

23 January 2009 at 7:41am

I have a site where I want to add a field to the CMS where a button is pressed and a popup shows a list of predetermined thumbnails that can then be selected. I want to control the placement of the image on the page instead of having the CMS user try to place it using the tinymce interface.

There is only one image per page and it is not selectable from the file system directly. We choose 30 images and put them in a folder with thumbnails. These thumbnails are then displayed for the user to pick one. Once the image is picked it goes into the database so that it can be rendered correctly on the page. Then once the image has been picked it the thumbnail would be displayed also in the CMS for that page and a button would be there for selecting a new one if need be.

I know how to parse my folder of thumbnails and display them in a grid, what I don't know how to do is make it so when a thumbnail is clicked the database is updated with the path to the image without reloading the whole CMS page. I assume there is some ajax involved but don't know anything about that.

Is there anything built in for this kind of functionality or can someone help me figure out the part where the image is clicked and the path saved so that the database is updated when the save or save and publish buttons are pressed?

Avatar
dio5

Community Member, 501 Posts

1 February 2009 at 6:32am