[Image Resizer] Add warning for gif files (#12892)

This commit is contained in:
Jaime Bernardo 2021-08-25 16:50:35 +01:00 committed by GitHub
parent 0f55256262
commit 39d46074d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 36 additions and 5 deletions

View File

@ -59,7 +59,7 @@ namespace ImageResizer.Properties {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to All Files.
/// </summary>
@ -77,7 +77,7 @@ namespace ImageResizer.Properties {
return ResourceManager.GetString("Cancel", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Height.
/// </summary>
@ -123,6 +123,15 @@ namespace ImageResizer.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Gif files with animations may not be correctly resized..
/// </summary>
public static string Input_GifWarning {
get {
return ResourceManager.GetString("Input_GifWarning", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Ign_ore the orientation of pictures.
/// </summary>

View File

@ -142,6 +142,9 @@
<data name="Input_IgnoreOrientation" xml:space="preserve">
<value>Ign_ore the orientation of pictures</value>
</data>
<data name="Input_GifWarning" xml:space="preserve">
<value>Gif files with animations may not be correctly resized.</value>
</data>
<data name="Input_Replace" xml:space="preserve">
<value>R_esize the original pictures (don't create copies)</value>
</data>

View File

@ -2,6 +2,7 @@
// The Brice Lambson licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information. Code forked from Brice Lambson's https://github.com/bricelam/ImageResizer/
using System.Linq;
using System.Windows.Input;
using ImageResizer.Helpers;
using ImageResizer.Models;
@ -42,6 +43,15 @@ namespace ImageResizer.ViewModels
public ICommand CancelCommand { get; }
public bool TryingToResizeGifFiles
{
get
{
// Any of the files is a gif.
return _batch.Files.Any(filename => filename.EndsWith(".gif", System.StringComparison.InvariantCultureIgnoreCase));
}
}
public void Resize()
{
Settings.Save();

View File

@ -185,7 +185,6 @@
<CheckBox Margin="12,4,12,0"
Content="{x:Static p:Resources.Input_IgnoreOrientation}"
IsChecked="{Binding Settings.IgnoreOrientation}"/>
<Border Margin="0,24,0,0"
Background="{DynamicResource SecondaryBackgroundBrush}"
BorderBrush="{DynamicResource PrimaryBorderBrush}"
@ -193,14 +192,24 @@
Padding="12">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition />
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock Grid.Column="0"
FontWeight="Bold"
Text="{x:Static p:Resources.Input_GifWarning}"
TextWrapping="Wrap"
MaxWidth="250"
HorizontalAlignment="Left"
TextAlignment="Left"
Foreground="{ui:ThemeResource SystemControlErrorTextForegroundBrush}"
Visibility="{Binding TryingToResizeGifFiles, Converter={StaticResource BoolValueConverter}}"
/>
<Button Grid.Column="1"
Style="{StaticResource AccentButtonStyle}"
MinWidth="76"
Margin="12,0,0,0"
Command="{Binding ResizeCommand}"
AutomationProperties.Name="{x:Static p:Resources.Resize_Tooltip}"
Content="{x:Static p:Resources.Input_Resize}"