London Dev Meetup Rescheduled! Due to unavoidable reasons, the event has been moved to 21st May. Speakers remain the same—any changes will be communicated. Seats are limited—register here to secure your spot!

ImageEditor don't copy filesummary?

Vote:
 

FileSummary.config:

  <model>
    <instance>
      <Author />
      <Publisher />
      <Description />
    </instance>
  </model>

    

When users upload images, they enter photographer under Author in EPiServer's filemanager->Edit fileinfo. When I copy->paste a file in EPiServers filemanager, the fileinfo is copied as well. But when I insert an image into an article, open EPiServers ImageEditor, resize the image, and save a copy in the pagefolder, the fileinfo is not copied. Is this a bug/missing functionallity in EPiServers ImageEditor? I think the file is saved in EPiServer.UI.Edit.ImageEditor.Core.FileIO.SaveFileAs():

    public static void SaveFileAs(string originalVirtualPath, string newVirtualPath, List<ImageOperation> imageOperations, int jpegQuality, PageReference pageForPageFolder)
    {
      string mimeMapping = EPiServer.Web.MimeMapping.GetMimeMapping(newVirtualPath);
      byte[] buffer;
      using (Stream stream = HostingEnvironment.VirtualPathProvider.GetFile(originalVirtualPath).Open())
      {
        byte[] numArray = new byte[stream.Length];
        stream.Read(numArray, 0, (int) stream.Length);
        buffer = new ImageServiceClient("ImageServiceClientEndPoint").RenderImage(numArray, (IEnumerable<ImageOperation>) imageOperations, mimeMapping, 1f, jpegQuality);
      }
      UnifiedFile unifiedFile = HostingEnvironment.VirtualPathProvider.GetFile(newVirtualPath) as UnifiedFile ?? (HostingEnvironment.VirtualPathProvider.GetDirectory(VirtualPathUtility.GetDirectory(newVirtualPath)) as UnifiedDirectory).CreateFile(VirtualPathUtility.GetFileName(newVirtualPath));
      if (!PageReference.IsNullOrEmpty(pageForPageFolder))
        unifiedFile.SetPageForAccessControl(pageForPageFolder);
      using (Stream stream = unifiedFile.Open(FileMode.OpenOrCreate, FileAccess.Write))
        stream.Write(buffer, 0, buffer.Length);
      IVersioningFile versioningFile = unifiedFile as IVersioningFile;
      if (versioningFile == null || !versioningFile.IsCheckedOut)
        return;
      versioningFile.CheckIn(string.Empty);
    }

    

Do you have a suggestion for a workaround?

EPiServer 6 R2 (6.1.379.0)

-Thomas

#72731
Jun 27, 2013 10:58
Vote:
 

Here is a proposed BUGFIX/SOLUTION: Add the following two lines in EPiServer.UI.Edit.ImageEditor.Core.FileIO's SaveFileAs()-method (at line 16 in my previous post):

var originalUnifiedFile = HostingEnvironment.VirtualPathProvider.GetFile(originalVirtualPath) as UnifiedFile;
UnifiedFile.CopySummary(originalUnifiedFile, unifiedFile);

    

Looks like a simple fix, is it possible to get this fixed in the next version? :)

#72989
Edited, Jul 03, 2013 14:18
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.