[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
4 changed files with 36 additions and 5 deletions

View File

@@ -59,7 +59,7 @@ namespace ImageResizer.Properties {
resourceCulture = value; resourceCulture = value;
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to All Files. /// Looks up a localized string similar to All Files.
/// </summary> /// </summary>
@@ -77,7 +77,7 @@ namespace ImageResizer.Properties {
return ResourceManager.GetString("Cancel", resourceCulture); return ResourceManager.GetString("Cancel", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// Looks up a localized string similar to Height. /// Looks up a localized string similar to Height.
/// </summary> /// </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> /// <summary>
/// Looks up a localized string similar to Ign_ore the orientation of pictures. /// Looks up a localized string similar to Ign_ore the orientation of pictures.
/// </summary> /// </summary>

View File

@@ -142,6 +142,9 @@
<data name="Input_IgnoreOrientation" xml:space="preserve"> <data name="Input_IgnoreOrientation" xml:space="preserve">
<value>Ign_ore the orientation of pictures</value> <value>Ign_ore the orientation of pictures</value>
</data> </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"> <data name="Input_Replace" xml:space="preserve">
<value>R_esize the original pictures (don't create copies)</value> <value>R_esize the original pictures (don't create copies)</value>
</data> </data>

View File

@@ -2,6 +2,7 @@
// The Brice Lambson licenses this file to you under the MIT license. // 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/ // 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 System.Windows.Input;
using ImageResizer.Helpers; using ImageResizer.Helpers;
using ImageResizer.Models; using ImageResizer.Models;
@@ -42,6 +43,15 @@ namespace ImageResizer.ViewModels
public ICommand CancelCommand { get; } 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() public void Resize()
{ {
Settings.Save(); Settings.Save();

View File

@@ -185,7 +185,6 @@
<CheckBox Margin="12,4,12,0" <CheckBox Margin="12,4,12,0"
Content="{x:Static p:Resources.Input_IgnoreOrientation}" Content="{x:Static p:Resources.Input_IgnoreOrientation}"
IsChecked="{Binding Settings.IgnoreOrientation}"/> IsChecked="{Binding Settings.IgnoreOrientation}"/>
<Border Margin="0,24,0,0" <Border Margin="0,24,0,0"
Background="{DynamicResource SecondaryBackgroundBrush}" Background="{DynamicResource SecondaryBackgroundBrush}"
BorderBrush="{DynamicResource PrimaryBorderBrush}" BorderBrush="{DynamicResource PrimaryBorderBrush}"
@@ -193,14 +192,24 @@
Padding="12"> Padding="12">
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition/> <ColumnDefinition />
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/> <ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions> </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" <Button Grid.Column="1"
Style="{StaticResource AccentButtonStyle}" Style="{StaticResource AccentButtonStyle}"
MinWidth="76" MinWidth="76"
Margin="12,0,0,0"
Command="{Binding ResizeCommand}" Command="{Binding ResizeCommand}"
AutomationProperties.Name="{x:Static p:Resources.Resize_Tooltip}" AutomationProperties.Name="{x:Static p:Resources.Resize_Tooltip}"
Content="{x:Static p:Resources.Input_Resize}" Content="{x:Static p:Resources.Input_Resize}"