Preferred implementation for image field

Topics: Core, General
Nov 21, 2012 at 9:42 AM

Using orchard v1.6. I am trying to decide the best approach for adding an image in my custom content type. The final goal is to serve content of this content type through a projection, thus creating a slideshow with no other module.

My requirements for an image field would be: 

  • load an image from user's computer (optional url)
  • alt field
  • title field
  • be able to use the above fields through projections
  • Nice to have: drupal-style image styles, being able to crop, scale etc.

My options seem to lie between media picker field, and image field through the image module. 

  • Added Media picker field on content type: I can set the alt field through media upload popup. Can't seem to find a title field. Then it gets wierder. I can only get a ~/folder/image.jpg link from projections. Not the actual img tag.
  • Added image module field on content type: even less options, not sure what I can get from projections.
  • Created an image part with the image module field in it: suddenly I have more options this way, with image resizing etc. Why is does it work differently when not in a part?

Which way should I go? I am totally confused.

Developer
Dec 17, 2012 at 1:07 PM
Edited Dec 17, 2012 at 1:08 PM

The MediaPickerField has more options, so unless you are going to implement your own content field, I would use that one. Another benefit of using MediaPickerField over ImageField is that with MediaPickerField you can select existing images, where as with ImageField, you will always have to upload an image from your pc.

By default, the MediaPickerField renders the selected image url. It's up to you to provide a template that renders an img tag with the configured image url.