1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Remove Images From Database

Remove Images From Database

9 posts, 0 answered
  1. gohigher
    gohigher avatar
    25 posts
    Registered:
    24 Nov 2008
    20 Jul 2010
    Link to this post
    Given the growing size of our current database and the new capabilities from the latest service pack, we are looking to store all image files via the file system. I have seen some examples on the code to use to pull the images out of the database, but am not sure on how to execute it. We are running Visual Studio 2010 and made what we believed to be the correct references, but are receiving errors on compilation. Could you please provide us with a step by step method of accomplishing this?

    Thank you.
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    20 Jul 2010
    Link to this post
    Hi gohigher,

    You could take a look at this post where we have provided code samples and sample project that show how to migrate items from database to the file system.

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. gohigher
    gohigher avatar
    25 posts
    Registered:
    24 Nov 2008
    20 Jul 2010
    Link to this post
    Thank you. But references do I need to make in our project?
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    20 Jul 2010
    Link to this post
    Hello gohigher,

    In need to implement the same logic in you project as discussed in the forum post.

    All the best,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. gohigher
    gohigher avatar
    25 posts
    Registered:
    24 Nov 2008
    20 Jul 2010
    Link to this post
    I did but am receiving errors.

    Compilation Error

    Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

    Compiler Error Message: CS0246: The type or namespace name 'LibraryManager' could not be found (are you missing a using directive or an assembly reference?)

    Source Error:

    Line 15:     {
    Line 16:         string storage = "C:\\Projects\\Sitefinity\\Images\\";
    Line 17: var man = new LibraryManager();Line 18:         ILibrary lib = man.GetLibrary("ImageGallery");
    Line 19:         IList allImages = lib.GetItems();

    I've discovered the correct reference to the Telerik.Libraries module but am receiving errors when referencing the IList, IContent, MemoryStream, and ImageFormat data types in the project.
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    20 Jul 2010
    Link to this post
    Hi gohigher,

    IContent - Telerik.Cms.Engine.IContent. For the other interfaces, please refer to MSDN.

    All the best,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  7. gohigher
    gohigher avatar
    25 posts
    Registered:
    24 Nov 2008
    20 Jul 2010
    Link to this post
    Almost there Ivan. Last error is "Using the generic type 'System.Collections.Generic.IList<T>" requires 1 type arguments. Thank you.
  8. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    12 Sep 2017
    20 Jul 2010
    Link to this post
    Hi gohigher,

    Use System.Collections.IList if this is not a generic list.

    Best wishes,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  9. gohigher
    gohigher avatar
    25 posts
    Registered:
    24 Nov 2008
    20 Jul 2010
    Link to this post
    I don't follow you. The line of code is asking for an argument.            
Register for webinar
9 posts, 0 answered