Orchard 1.7 Exception after Image Gallery install

Topics: Core, Installing Orchard, Troubleshooting
Aug 29, 2013 at 2:39 AM
Good day!

Installed 1.7, moved media, did "upgrade" etc... Went to the Modules->Gallery->Install Image Gallery. And then:

None of the constructors found with 'Orchard.Environment.AutofacUtil.DynamicProxy2.ConstructorFinderWrapper' on type 'Mello.ImageGallery.Services.ImageGalleryService' can be invoked with the available services and parameters:
Cannot resolve parameter 'Orchard.Media.Services.IMediaService mediaService' of constructor 'Void .ctor(Orchard.Media.Services.IMediaService, Orchard.Data.IRepository1[Mello.ImageGallery.Models.ImageGallerySettingsRecord], Orchard.Data.IRepository1[Mello.ImageGallery.Models.ImageGalleryImageSettingsRecord], Mello.ImageGallery.Services.IThumbnailService, Orchard.Data.IRepository`1[Mello.ImageGallery.Models.ImageGalleryRecord], Orchard.IOrchardServices, Orchard.FileSystems.Media.IStorageProvider)'.


Any one has any ideas? Thanjs,
Aug 29, 2013 at 2:39 AM
Forgot to say, that I deleted the module and my site is functioning. But I would really like to use the image gallery...
Developer
Aug 29, 2013 at 5:51 AM
It looks like the author of the module would have to make it compatible with 1.7's new Media Library module.
Or perhaps it's a simple matter of enabling the deprecated Media feature to make it work.
Aug 29, 2013 at 2:37 PM
Thank you for the reply. Now I have two options:

1.) Change the module instead of the developer
2.) Use something else.

I am more inclined towards the second option for I don`t have much time on my hands.
What in your opinion is the best was of displaying "photo albums" using Orchard 1.7 ?

Thanks.
Coordinator
Aug 29, 2013 at 7:41 PM
In 1.7, I use a Media Library Field configured for multiple media, then I customize the templates in my theme.
Developer
Aug 30, 2013 at 2:10 AM
+1 I do that too.
Aug 30, 2013 at 4:21 AM
Thank you for the reply,
Would you have sample layouts for displaying media?
Coordinator
Aug 30, 2013 at 8:06 AM
Here's my Fields_MediaLibraryPicker.cshtml:
@using Orchard.ContentManagement
@using Orchard.MediaLibrary.Fields
@using Orchard.Utility.Extensions;

@{
    var field = (MediaLibraryPickerField) Model.ContentField;
    string name = field.DisplayName;
    var contents = field.MediaParts;
}
<section class="media-library-picker-field media-library-picker-field-@name.HtmlClassify()">
    @foreach(var content in contents) {
    <div>
        @Display(BuildDisplay(content, "Summary"))
    </div>
    }
</section>
Coordinator
Aug 30, 2013 at 8:07 AM
And my Media.Summary.cshtml:
@using Orchard.MediaLibrary.Models
@using Orchard.Utility.Extensions;
@{
    MediaPart mediaPart = Model.ContentItem.MediaPart;
}
<a href="@mediaPart.MediaUrl">
    <img src="@Display.ResizeMediaUrl(Width: 200, Height: 200, Mode: "crop", Alignment: "middlecenter", Path: mediaPart.MediaUrl)" alt="@mediaPart.Caption" class="thumbnail"/>
</a>
Coordinator
Aug 30, 2013 at 8:08 AM
Add your favorite library/gallery script on top of that and you're good to go.
Aug 30, 2013 at 7:28 PM
Thanks a lot. I will try that. My ultimate goal though is to spread images over several columns... I'll post my solution once I am through with it.
Sep 4, 2013 at 4:58 AM
Edited Sep 4, 2013 at 5:44 PM
Here is a little piece of code that arranges media in 3 columns:

Fields_MediaLibraryPicker.cshtml:
@using Orchard.ContentManagement
@using Orchard.MediaLibrary.Fields
@using Orchard.Utility.Extensions;

@{
    var field = (MediaLibraryPickerField) Model.ContentField;
    string name = field.DisplayName;
    var contents = field.MediaParts;
}
<section class="media-library-picker-field media-library-picker-field-@name.HtmlClassify()">
    <h3>@name</h3>
    @{
        
        var lcontents = contents.ToList();
      
    }
    <table width="100%">
        
        @for (var i = 0; i < lcontents.Count; i++)
        {
       
     
            <tr>
                <td>@Display(BuildDisplay(lcontents[i], "Summary"))</td>
                <td>
                    @if (++i < lcontents.Count)
                    {
                        @Display(BuildDisplay(lcontents[i], "Summary"));
                    }
                </td>
                <td>
                    @if (++i < lcontents.Count)
                    {
                        @Display(BuildDisplay(lcontents[i], "Summary"));
                    }
                </td>
            </tr>
     
        }
    </table>

</section>

Sep 4, 2013 at 2:46 PM
BertrandLeRoy wrote:
Add your favorite library/gallery script on top of that and you're good to go.
What do you mean by that?
Sep 4, 2013 at 4:52 PM
I'm trying to use some image gallery modules but all of them seem to be incompatible with Orchard 1.7.

Since I'm really new into Orchard, can you please tell me how can I re-enable the Orchard.Media deprecated module to make it compatible?

What are the differences between Orchard.Media and the new Media module?

What is the name of the new module?
Sep 4, 2013 at 5:43 PM
You can enable it in "Modules". Type "Media" in the search box and youll get the old Media (disabled) and Media Library (enabled). Do what you have to do with it.

Yet, I wouldn
t go with deprecated stuff for there will be no support for it in the future and you do not want to invest in something that is being phased out. Plus the new media library is a lot more user friendly and powerful. In 1.7.1 theyre going to introduce some more enhancements to it.

Eventually, there will be new image gallery modules developed (or old ones will be upgraded to be compatible with 1.7) and you
ll be able to use them. As for now' I am using the solution described above. Looks fine to me. You can do some jQuery fancying up with it if you want.
Sep 4, 2013 at 5:57 PM
fimine wrote:
You can enable it in "Modules". Type "Media" in the search box and youll get the old Media (disabled) and Media Library (enabled). Do what you have to do with it.

Yet, I wouldn
t go with deprecated stuff for there will be no support for it in the future and you do not want to invest in something that is being phased out. Plus the new media library is a lot more user friendly and powerful. In 1.7.1 theyre going to introduce some more enhancements to it.

Eventually, there will be new image gallery modules developed (or old ones will be upgraded to be compatible with 1.7) and you
ll be able to use them. As for now' I am using the solution described above. Looks fine to me. You can do some jQuery fancying up with it if you want.
Thank you for the repply. I understand what you say about deprecated stuff but since I'm in investigation stages it is better for me to see things working, even if they are going to change a little in the future.

Also, as I'm really new into this whole Orchard - MVC world I don't get any of the suggestions described above, they are in a level of difficulty a little bit high for me right now. Though I'm studying both tools, Orchard and MVC framework.

If you can get the time to explain the solution above in a more detailed - noob way it would be really nice, if you can't then I will enable the deprecated module and play with Orchard that way.

In the future, as I get more knowledge, I'm sure I will understand more of these suggestions, or I will be able to fix this problems myself.

Thanks again!
Sep 4, 2013 at 6:15 PM
Edited Sep 4, 2013 at 6:20 PM
If you don't have programming experience it would be a bit hard for you (the MVC part and customization)... Try doing the following:

1.) Define your own content type (use admin menu - Content Defninition - New) or edit the existing type - Page (for purpose of the exercise);
2) While in edit mode, click on "add field"
3) Give your field a name and choose its type (Media Library Picker)
4) In Modules enable Media Library

You're good to go with standard media library display. In your page, when creating/editing you'll now have a field where you can add your pictures from the library.

If you want to customize it, you need to read more on Shape Tracing and alternatives. Basically it allows you to create your own layouts, that are stored in your theme, so they will be displayed instead of the standard ones. The one I show above replaces standard Fields_MediaLibraryPicker.cshtml, which Bertrand has offered...

But I wouldn't start with alternatives etc before getting comfortable with the standard features.

The answer to most questions here is: EXPERIMENT.
Sep 4, 2013 at 6:26 PM
fimine wrote:
If you don't have programming experience it would be a bit hard for you... Try doing the following:

1.) Define your own content type (use admin menu - Content Defninition - New) or edit the existing type - Page (for purpose of the exercise);
2) While in edit mode, click on "add field"
3) Give your field a name and choose its type (Media Library Picker)
4) In Modules enable Media Library

You're good to go with standard media library display. In your page, when creating/editing you'll now have a field where you can add your pictures from the library.

If you want to customize it, you need to read more on Shape Tracing and alternatives. Basically it allows you to create your own layouts, that are stored in your theme, so they will be displayed instead of the standard ones. The one I show above replaces standard Fields_MediaLibraryPicker.cshtml, which Bertrand has offered...

But I wouldn't start with alternatives etc before getting comfortable with the standard features.

The answer to most questions here is: EXPERIMENT.
Thanks again fimine. I have programming experience, I'm just studying a framework I don't know yet (MVC) and Orchard (as a user and underneath), so that's why my understanding right now is limited.

If I follow your last advice, I will add a content part (media library) to the content type (page), is this true? If it is, then what I will have is an option to upload files to a page while creating it, right?

The problem here is that what I want to get working is the different modules developed that used to work with Ochard.Media and that are useless with the recent changes, so I guess that if I understood your suggestion it still leaves me with the same problem.

=)
Sep 4, 2013 at 6:36 PM
" I will add a content part "
not part - field.

As for making old modules work, you have two options:

1) Revamp them yourself.
OR
2) Enable the deprecated Media feature.
Sep 28 at 11:30 PM
"Tip: Use ctrl + click to select multiple images at once."

I am not able to select more than one image at a time. Is there a fix for that someone might know about?