Skip to content

Commit

Permalink
[Image Resizer] Add warning for gif files (#12892)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimecbernardo committed Aug 25, 2021
1 parent 0f55256 commit 39d4607
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 5 deletions.
13 changes: 11 additions & 2 deletions src/modules/imageresizer/ui/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions src/modules/imageresizer/ui/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
10 changes: 10 additions & 0 deletions src/modules/imageresizer/ui/ViewModels/InputViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -42,6 +43,15 @@ public class InputViewModel : Observable

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();
Expand Down
15 changes: 12 additions & 3 deletions src/modules/imageresizer/ui/Views/InputPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -185,22 +185,31 @@
<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}"
BorderThickness="0,1,0,0"
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}"
Expand Down

0 comments on commit 39d4607

Please sign in to comment.