Browse Source

Fixing missing .web component.

Also merging Thomas Broust's client profile fix


Former-commit-id: f62ff9c5c9e20bd5d9af3226c4e80c0eda7d748a
af/merge-core
James South 12 years ago
parent
commit
47a4e8e337
  1. 20
      src/ImageProcessor.Web/NET45/ImageFactoryExtensions.cs
  2. 20
      src/ImageProcessor/ImageFactory.cs
  3. 1
      src/Images/Thumbs.db.REMOVED.git-id
  4. 1
      src/Images/WP_000009.jpg.REMOVED.git-id

20
src/ImageProcessor.Web/NET45/ImageFactoryExtensions.cs

@ -15,6 +15,7 @@ namespace ImageProcessor.Web
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using ImageProcessor.Extensions;
@ -105,6 +106,25 @@ namespace ImageProcessor.Web
{
factory.Update(processor.Invoke(factory));
}
// Set the property item information from any Exif metadata.
// We do this here so that they can be changed between processor methods.
if (factory.PreserveExifData)
{
foreach (KeyValuePair<int, PropertyItem> propertItem in factory.ExifPropertyItems)
{
try
{
factory.Image.SetPropertyItem(propertItem.Value);
}
// ReSharper disable once EmptyGeneralCatchClause
catch
{
// Do nothing. The image format does not handle EXIF data.
// TODO: empty catch is fierce code smell.
}
}
}
}
}
}

20
src/ImageProcessor/ImageFactory.cs

@ -37,11 +37,6 @@ namespace ImageProcessor
/// </summary>
private const int DefaultJpegQuality = 90;
/// <summary>
/// Whether to preserve exif metadata
/// </summary>
private readonly bool preserveExifData;
/// <summary>
/// The backup image format.
/// </summary>
@ -76,11 +71,11 @@ namespace ImageProcessor
/// Initializes a new instance of the <see cref="ImageFactory"/> class.
/// </summary>
/// <param name="preserveExifData">
/// Whether to preserve exif metadata. Defaults to false.
/// Whether to preserve exif metadata. Defaults to true.
/// </param>
public ImageFactory(bool preserveExifData = true)
{
this.preserveExifData = preserveExifData;
this.PreserveExifData = preserveExifData;
this.ExifPropertyItems = new ConcurrentDictionary<int, PropertyItem>();
}
#endregion
@ -142,6 +137,11 @@ namespace ImageProcessor
}
}
/// <summary>
/// Gets or sets a value indicating whether to preserve exif metadata.
/// </summary>
public bool PreserveExifData { get; set; }
/// <summary>
/// Gets or sets the exif property items.
/// </summary>
@ -182,7 +182,7 @@ namespace ImageProcessor
this.backupImageFormat = this.ImageFormat;
this.isIndexed = ImageUtils.IsIndexed(this.Image);
if (this.preserveExifData)
if (this.PreserveExifData)
{
foreach (PropertyItem propertyItem in this.Image.PropertyItems)
{
@ -244,7 +244,7 @@ namespace ImageProcessor
this.ImageFormat = imageFormat;
this.isIndexed = ImageUtils.IsIndexed(this.Image);
if (this.preserveExifData)
if (this.PreserveExifData)
{
foreach (PropertyItem propertyItem in this.Image.PropertyItems)
{
@ -1077,7 +1077,7 @@ namespace ImageProcessor
// Set the property item information from any Exif metadata.
// We do this here so that they can be changed between processor methods.
if (this.preserveExifData)
if (this.PreserveExifData)
{
foreach (KeyValuePair<int, PropertyItem> propertItem in this.ExifPropertyItems)
{

1
src/Images/Thumbs.db.REMOVED.git-id

@ -0,0 +1 @@
a3324e1e607ce97a44495fe239782e3b76da6129

1
src/Images/WP_000009.jpg.REMOVED.git-id

@ -0,0 +1 @@
85a8ae18f9955def2b42ba9240bce4de1bfe5781
Loading…
Cancel
Save