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.

General Questions

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

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

Custom image picker for CMS


Reply

2 Posts   1244 Views

Avatar
micahsheets

23 January 2009 at 7:41am Community Member, 164 Posts

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

1 February 2009 at 6:32am Community Member, 501 Posts

Hi

Have a look this module: http://www.silverstripe.org/archive/show/134180