| Server IP : 208.122.213.31 / Your IP : 216.73.216.185 Web Server : Apache System : Linux msd6191.mjhst.com 4.18.0-553.137.1.el8_10.x86_64 #1 SMP Wed Jun 24 11:40:24 UTC 2026 x86_64 User : WHMCS_MIA_382 ( 1001) PHP Version : 7.4.33 Disable Function : NONE MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/httpd/html/bukkake-mpegs.com/cgi-bin/tgps/ |
Upload File : |
#########################################
## http://www.jmbsoft.com/policies.php ##
#########################################
my $module = 1;
eval('use Image::Magick;');
if( $@ )
{
$module = 0;
}
sub AutoResize
{
$module ? PMDAutoResize(shift, shift, shift) : CLIAutoResize(shift, shift, shift);
}
sub ManualResize
{
$module ? PMDManualResize(shift, shift) : CLIManualResize(shift, shift);
}
sub Annotate
{
$module ? PMDAnnotate(shift, shift) : CLIAnnotate(shift, shift);
}
sub PMDAutoResize
{
my $buffer = shift;
my $temp_name = shift;
my $category = shift;
my $width = $THUMB_WIDTH || 100;
my $height = $THUMB_HEIGHT || 100;
my $quality = $THUMB_QUALITY || 80;
my $image = undef;
my $result = undef;
my $orig_width = 0;
my $orig_height = 0;
my $new_width = 0;
my $new_height = 0;
my $src_x = 0;
my $src_y = 0;
if( ref($buffer) )
{
FileWrite("$THUMB_DIR/$temp_name.jpg", $$buffer);
$buffer = "$THUMB_DIR/$temp_name.jpg";
}
$image = new Image::Magick;
$result = $image->Read($buffer);
if( $result )
{
FileRemove($buffer);
return 0;
}
($orig_width, $orig_height) = $image->Get('width', 'height');
$new_width = $width;
$new_height = $orig_height*($width/$orig_width);
$src_x = 0;
$src_y = ($new_height-$height)/2;
if( $new_height < $height )
{
$new_width = $orig_width*($height/$orig_height);
$new_height = $height;
$src_x = ($new_width-$width)/2;
$src_y = 0;
}
$image->Resize(width=>$new_width, height=>$new_height, filter=>Lanczos, blur=>1.0);
$image->Crop(width=>$width, height=>$height, x=>$src_x, y=>$src_y);
$image->Sharpen(radius => 0.5, sigma => 1.0);
$image->Profile(name => '*');
$image->Set(quality => $quality);
if( $O_ANNOTATE )
{
$image->Annotate(text => $category, font => "$FONT_DIR/$CATEGORY_FONT", pointsize => $POINTSIZE,
stroke => 'black', strokewidth => '1', fill => 'white', antialias => 'true',
x => '2', y => ($height - 4));
}
$image->Write($buffer);
}
sub PMDAnnotate
{
my $file = shift;
my $category = shift;
my $image = undef;
my $result = undef;
my $height = undef;
my $quality = $THUMB_QUALITY || 80;
$image = new Image::Magick;
$result = $image->Read($file);
if( $result )
{
FileRemove($file);
return 0;
}
$height = $image->Get('height');
$image->Annotate(text => $category, font => "$FONT_DIR/$CATEGORY_FONT", pointsize => $POINTSIZE,
stroke => 'black', strokewidth => '1', fill => 'white', antialias => 'true',
x => '2', y => ($height - 4));
$image->Profile(name => '*');
$image->Set(quality => $quality);
$image->Write($file);
}
sub PMDManualResize
{
my $buffer = shift;
my $category = shift;
my $width = $THUMB_WIDTH || 100;
my $height = $THUMB_HEIGHT || 100;
my $quality = $THUMB_QUALITY || 80;
my $image = undef;
my $result = undef;
$image = new Image::Magick;
$result = $image->Read($buffer);
if( $result )
{
Error($result, $buffer);
}
$image->Crop(width=>$F{'width'}, height=>$F{'height'}, x=>$F{'x'}, y=>$F{'y'});
if( $F{'width'} != $width || $F{'height'} != $height )
{
$image->Resize(width=>$width, height=>$height, filter=>Lanczos, blur=>1.0);
$image->Sharpen(radius=>0.5, sigma=>1.0);
}
$image->Profile(name => '*');
$image->Set(quality => $quality);
if( $O_ANNOTATE )
{
$image->Annotate(text => $category, font => "$FONT_DIR/$CATEGORY_FONT", pointsize => $POINTSIZE,
stroke => 'black', strokewidth => '1', fill => 'white', antialias => 'true',
x => '2', y => ($height - 4));
}
$image->Write($buffer);
}
sub CLIAutoResize
{
my $buffer = shift;
my $temp_name = shift;
my $category = shift;
my $width = $THUMB_WIDTH || 100;
my $height = $THUMB_HEIGHT || 100;
my $quality = $THUMB_QUALITY || 80;
my $orig_width = 0;
my $orig_height = 0;
my $new_width = 0;
my $new_height = 0;
my $src_x = 0;
my $src_y = 0;
my $command = undef;
my $annotate = undef;
if( ref($buffer) )
{
FileWrite("$THUMB_DIR/$temp_name.jpg", $$buffer);
$buffer = "$THUMB_DIR/$temp_name.jpg";
}
if( `$IDENTIFY -format %wx%h $buffer` =~ /(\d+)x(\d+)/ )
{
$orig_width = $1;
$orig_height = $2;
$new_width = $width;
$new_height = $orig_height*($width/$orig_width);
$src_x = 0;
$src_y = ($new_height-$height)/2;
if( $new_height < $height )
{
$new_width = $orig_width*($height/$orig_height);
$new_height = $height;
$src_x = ($new_width-$width)/2;
$src_y = 0;
}
$command = "$CONVERT +profile \"*\" -compress JPEG -quality $quality -filter Lanczos -resize $new_width" . "x$new_height -crop $width" . "x$height+$src_x+$src_y -sharpen 0.5x1.0 $buffer $buffer";
$annotate = "$CONVERT -font $FONT_DIR/$CATEGORY_FONT -pointsize $POINTSIZE -stroke black -strokewidth 1 -fill white -antialias true -draw 'text 2," . ($height - 4) . " \"$category\"' $buffer $buffer";
print `$command 2>&1`;
print `$annotate 2>&1` if( $O_ANNOTATE );
}
else
{
unlink("$THUMB_DIR/$temp_name.jpg");
}
}
sub CLIAnnotate
{
my $file = shift;
my $category = shift;
my $height = undef;
if( `$IDENTIFY -format %wx%h $file` =~ /(\d+)x(\d+)/ )
{
$height = $2;
$annotate = "$CONVERT -font $FONT_DIR/$CATEGORY_FONT -pointsize $POINTSIZE -stroke black -strokewidth 1 -fill white -antialias true -draw 'text 2," . ($height - 4) . " \"$category\"' $file $file";
print `$annotate 2>&1`;
}
else
{
unlink($file);
}
}
sub CLIManualResize
{
my $buffer = shift;
my $category = shift;
my $width = $THUMB_WIDTH || 100;
my $height = $THUMB_HEIGHT || 100;
my $quality = $THUMB_QUALITY || 80;
my $annotate = "$CONVERT -font $FONT_DIR/$CATEGORY_FONT -pointsize $POINTSIZE -stroke black -strokewidth 1 -fill white -antialias true -draw 'text 2," . ($height - 4) . " \"$category\"' $buffer $buffer";
my $resize = "$CONVERT +profile \"*\" -compress JPEG -quality $quality -crop $F{'width'}x$F{'height'}+$F{'x'}+$F{'y'} -filter Lanczos -resize " . $width . "x$height -sharpen 0.5x1.0 $buffer $buffer";
print `$resize 2>&1`;
print `$annotate 2>&1` if( $O_ANNOTATE );
}
1;