Inserting image from Media Library with MediaLibraryPickerField

Topics: General
Aug 12, 2013 at 3:58 PM
I've created a custom widget that contains a title, body, link, and I need to be able to insert an image in the widget above the body text. The problem is that when selecting an image from the library using a MediaLibraryPickerField part in the widget, it will only display the thumbnail in the widget instead of the full size image.

Is there a way to override this that I'm missing? I'm not seeing anything in any settings and searching the web isn't bringing up any results related to this.
Aug 12, 2013 at 6:38 PM
Use shape tracing to find what shape you need to alternate in your theme.
Aug 12, 2013 at 7:31 PM
The shape tracing tool isn't helping at all, it doesn't display any info in the right pane (should it?) All I get is the info on the left with my zone highlighted and fields under like:

Zone [ThreePack]
-- Parts_Common_Body [empty]
-- Parts_Contents_Publish [empty]
-- Fields_Link [empty]
-- Fields_MediaLibraryPicker
---- Media
------ Parts_Title_Summary
------ Parts_Common_Metadata_Summary
-------- DateTime

The thumbnail of the image shows up and clicking it takes you to a content page showing the full image. I need to show the actual full image here and not the thumbnail, and if I attempt to edit Media.cshtml/Media.Thumbnail.cshtml/Media-Image.Thumbnail.cshtml/etc - no changes happen in my rendered markup. It always still displays the markup as Article/Header/etc with a thumbnail of 200x200.

I would resort to simply using the TinyMCE editor, but that wraps everything in p tags and presents another slew of issues. I'm having a hard time finding any documentation about using the MediaLibraryPickerField within a widget and placing where the photo goes, is there any official documentation on this somewhere?
Aug 12, 2013 at 8:14 PM
Yes it should. Something is wrong here.

In any case, you can also go into the driver's code for the field to see what the name of the shape is.

There's no doc on MediaLibraryPicker because it's so new.
Aug 12, 2013 at 9:54 PM
Hi Bertrand,

Running in to a whole different issue all together now - I can't even upload an image to the Media Library. It allows me to select an image from my computer and the progress bar goes to 100%, but no options to save/continue/or anything exist other than close. Clicking on close exits the uploader and the file is not in the library.

Error log shows:

2013-08-12 14:47:33,329 [1] Orchard.Exceptions.DefaultExceptionPolicy - An unexpected exception was caught
System.NullReferenceException: Object reference not set to an instance of an object.
at Orchard.MediaLibrary.Factories.ImageFactory.CreateMedia(Stream stream, String path, String mimeType)
at Orchard.MediaLibrary.Services.MediaLibraryService.ImportMedia(String relativePath, String filename)
at Orchard.MediaLibrary.Services.MediaLibraryService.ImportMedia(Stream stream, String relativePath, String filename)
at Orchard.MediaLibrary.Controllers.ClientStorageController.Upload(String folderPath)
at lambda_method(Closure , ControllerBase , Object[] )
at System.Web.Mvc.ActionMethodDispatcher.Execute(ControllerBase controller, Object[] parameters)
at System.Web.Mvc.ReflectedActionDescriptor.Execute(ControllerContext controllerContext, IDictionary`2 parameters)
at System.Web.Mvc.ControllerActionInvoker.InvokeActionMethod(ControllerContext controllerContext, ActionDescriptor action

The media library hasn't been very friendly with me the last few days!

Aug 12, 2013 at 10:35 PM
Looks like you have a corrupted database. Is this an upgrade from 1.6?
Aug 12, 2013 at 10:41 PM
No, this is a fresh install done a few days ago from the I was able to upload one image to the media library on Friday afternoon, but when going in today to add more to the library I noticed it wouldn't upload and the same error has been logging.

This site is using an external SQL database, are there certain tables that could be rebuilt to fix the database without needing to do a full dump and start over again?
Aug 13, 2013 at 2:15 AM
I don't know what's corrupted here. You should attach a debugger and find out what's throwing and why.