Fourth pass at adding key files
This commit is contained in:
		
							
								
								
									
										30
									
								
								site/slowtwitch.com/www/tick/scripts/pics.pl
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										30
									
								
								site/slowtwitch.com/www/tick/scripts/pics.pl
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
#!/usr/bin/perl
 | 
			
		||||
 | 
			
		||||
use Image::Magick;
 | 
			
		||||
 | 
			
		||||
my ($image);
 | 
			
		||||
my $filename = shift || exit(0);
 | 
			
		||||
my $append = shift || "";
 | 
			
		||||
my $max_height = shift || 200;
 | 
			
		||||
 | 
			
		||||
if ($append eq "---") { $append = ""; }
 | 
			
		||||
 | 
			
		||||
my $base = '/var/home/slowtwitch/slowtwitch.com/www/tick/images/gallery';
 | 
			
		||||
my $new_filename = "${base}/${append}${filename}";
 | 
			
		||||
 | 
			
		||||
$image = Image::Magick->new;
 | 
			
		||||
$image->Read("${base}/${filename}");
 | 
			
		||||
 | 
			
		||||
$width = $image->Get('columns');
 | 
			
		||||
$height = $image->Get('rows');
 | 
			
		||||
 | 
			
		||||
if (($width > 900) || ($height > $max_height))
 | 
			
		||||
{
 | 
			
		||||
    $image->Resize(geometry=>"${width}x${max_height}");
 | 
			
		||||
    # $image->Scale(geometry=>"${longest_side}x${longest_side}");
 | 
			
		||||
    # $image->Border(geometry=>'5x5');
 | 
			
		||||
    $image->Write(filename=>"${new_filename}", quality=>'75');
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
undef $image;
 | 
			
		||||
exit(0);
 | 
			
		||||
							
								
								
									
										30
									
								
								site/slowtwitch.com/www/tick/scripts/pics.pl~
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										30
									
								
								site/slowtwitch.com/www/tick/scripts/pics.pl~
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,30 @@
 | 
			
		||||
#!/usr/bin/perl
 | 
			
		||||
 | 
			
		||||
use Image::Magick;
 | 
			
		||||
 | 
			
		||||
my ($image);
 | 
			
		||||
my $filename = shift || exit(0);
 | 
			
		||||
my $append = shift || "";
 | 
			
		||||
my $max_height = shift || 200;
 | 
			
		||||
 | 
			
		||||
if ($append eq "---") { $append = ""; }
 | 
			
		||||
 | 
			
		||||
my $base = '/var/www/html/one/tick/images/gallery';
 | 
			
		||||
my $new_filename = "${base}/${append}${filename}";
 | 
			
		||||
 | 
			
		||||
$image = Image::Magick->new;
 | 
			
		||||
$image->Read("${base}/${filename}");
 | 
			
		||||
 | 
			
		||||
$width = $image->Get('columns');
 | 
			
		||||
$height = $image->Get('rows');
 | 
			
		||||
 | 
			
		||||
if (($width > 900) || ($height > $max_height))
 | 
			
		||||
{
 | 
			
		||||
    $image->Resize(geometry=>"${width}x${max_height}");
 | 
			
		||||
    # $image->Scale(geometry=>"${longest_side}x${longest_side}");
 | 
			
		||||
    # $image->Border(geometry=>'5x5');
 | 
			
		||||
    $image->Write(filename=>"${new_filename}", quality=>'75');
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
undef $image;
 | 
			
		||||
exit(0);
 | 
			
		||||
							
								
								
									
										35
									
								
								site/slowtwitch.com/www/tick/scripts/resizer.pl
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										35
									
								
								site/slowtwitch.com/www/tick/scripts/resizer.pl
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,35 @@
 | 
			
		||||
#!/usr/bin/perl
 | 
			
		||||
 | 
			
		||||
use Image::Magick;
 | 
			
		||||
 | 
			
		||||
sub get_files
 | 
			
		||||
{
 | 
			
		||||
    my @allFiles;
 | 
			
		||||
    
 | 
			
		||||
    opendir DIR, "/var/www/html/one/tick/images/gallery";
 | 
			
		||||
    @allFiles = grep !/^\./, readdir DIR;
 | 
			
		||||
    closedir DIR;
 | 
			
		||||
    
 | 
			
		||||
    foreach $file (@allFiles)
 | 
			
		||||
    {
 | 
			
		||||
	if ($file =~ m/^f\_.*?/)
 | 
			
		||||
        {
 | 
			
		||||
	    print "$file\n";
 | 
			
		||||
	    $image = Image::Magick->new;
 | 
			
		||||
	    $image->Read("/var/www/html/one/tick/images/gallery/${file}");
 | 
			
		||||
	    
 | 
			
		||||
	    $width = $image->Get('columns');
 | 
			
		||||
	    $height = $image->Get('rows');
 | 
			
		||||
	    
 | 
			
		||||
	    if (($width > 700) || ($height > 170))
 | 
			
		||||
	    {
 | 
			
		||||
		$image->Resize(geometry=>"1500x170");
 | 
			
		||||
		$image->Write(filename=>"/var/www/html/one/tick/images/gallery/t_${file}", quality=>'80');
 | 
			
		||||
	    }
 | 
			
		||||
	    
 | 
			
		||||
	    undef $image;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
&get_files();
 | 
			
		||||
							
								
								
									
										25
									
								
								site/slowtwitch.com/www/tick/scripts/thumbify.pl
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										25
									
								
								site/slowtwitch.com/www/tick/scripts/thumbify.pl
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,25 @@
 | 
			
		||||
#!/usr/bin/perl
 | 
			
		||||
# resize to 160 on the long edge and add black border
 | 
			
		||||
 | 
			
		||||
use Image::Magick;
 | 
			
		||||
 | 
			
		||||
$source_dir = shift || ".";
 | 
			
		||||
 | 
			
		||||
my @allFiles;    
 | 
			
		||||
opendir DIR, $source_dir;
 | 
			
		||||
@allFiles = grep !/^\./, readdir DIR;
 | 
			
		||||
closedir DIR;
 | 
			
		||||
 | 
			
		||||
foreach $file (@allFiles)
 | 
			
		||||
{
 | 
			
		||||
    if ($file =~ m/^b.*?\.jpg/g)
 | 
			
		||||
    {
 | 
			
		||||
	print "$file\n";
 | 
			
		||||
	$image = Image::Magick->new;
 | 
			
		||||
	$image->Read("$source_dir/${file}");
 | 
			
		||||
	$image->Resize(geometry=>"160x160");
 | 
			
		||||
	$image->Border(geometry=>"2x2", fill=>"black");
 | 
			
		||||
	$image->Write(filename=>"$source_dir/t_${file}", quality=>'75');
 | 
			
		||||
	undef $image;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user