Skip to content

Commit

Permalink
Wrapped filenames in double-quotes for issues with filenames that inc…
Browse files Browse the repository at this point in the history
…lude spaces.
  • Loading branch information
Mike Brittain committed Jul 28, 2010
1 parent 5dd3424 commit e53813b
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions wesley.pl
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,11 @@ sub compressJPG

# Run Progressive JPEG and Huffman table optimizations, then inspect
# which was best.
`$jpegtran_path -copy none -optimize $_ > $_.opt`;

`$jpegtran_path -copy none -optimize "$_" > "$_.opt"`;
my $opt_size = -s "$_.opt";

`$jpegtran_path -copy none -progressive $_ > $_.prog`;
`$jpegtran_path -copy none -progressive "$_" > "$_.prog"`;
my $prog_size = -s "$_.prog";

if ($opt_size && $opt_size < $orig_size && $opt_size <= $prog_size) {
Expand Down Expand Up @@ -205,7 +206,7 @@ sub compressPNG
print "Inspecting $fullname\n";

# Run pngcrush
`$pngcrush_path -rem alla -reduce -brute $_ $_.crush`;
`$pngcrush_path -rem alla -reduce -brute "$_" "$_.crush"`;
my $crush_size = -s "$_.crush";

if ($crush_size && $crush_size < $orig_size) {
Expand Down Expand Up @@ -235,7 +236,7 @@ sub compressGIF

print "Inspecting $fullname\n";

`$gifsicle_path --no-warnings --no-comments --optimize=2 $_ > $_.gifsicle`;
`$gifsicle_path --no-warnings --no-comments --optimize=2 "$_" > "$_.gifsicle"`;
my $gifsicle_size = -s "$_.gifsicle";

if ($gifsicle_size && $gifsicle_size < $orig_size) {
Expand All @@ -262,17 +263,17 @@ sub comparePNG
my $fullname = $File::Find::dir . '/' . $_;

# Only try converting static GIFs.
my $type = `$identify_path -format %m $_`;
my $type = `$identify_path -format %m "$_"`;
chomp $type;

if ($type eq 'GIF') {

print "Considering conversion to PNG: $fullname\n";

# Try converting to PNG and crush if possible.
`$convert_path $_ $_.try.png`;
`$convert_path "$_" "$_.try.png"`;
if ($pngcrush_path) {
`$pngcrush_path -rem alla -reduce -brute $_.try.png $_.try.crush`;
`$pngcrush_path -rem alla -reduce -brute "$_.try.png" "$_.try.crush"`;
$png_size = -s "$_.try.crush";
} else {
$png_size = -s "$_.try.png";
Expand All @@ -298,6 +299,7 @@ sub comparePNG
}
}


# Read search path from command line
sub readInput
{
Expand Down

1 comment on commit e53813b

@CiprianPoiana
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a beginner.
How to use this file?
Thanks

Please sign in to comment.