Resize jpg quality irssi perl

I have an irssi bot that saves me the images in mysql database but before saving them I would like to make a resize maintaining the quality, the images have all different resolutions.

the code to which I must add the resize is this

sub saveJpg {

my ($text, $server, $channel, $nick) = @_;

my $time = time();

my ($pre, $url, $jpgname, $checksum) = split(" ", $text);

$pre = trim($pre);

$url = trim($url);

$jpgname = trim($jpgname);

if (length($jpgname) > $limits{'jpgnameLength'}) {

my $message = "[".$red."ERROR".$reset."] ".$darkgrey."savejpg()--[jpg file name too long]--[!addjpg $pre $url $jpgname ]--[$nick]--[$channel]";

announceError($server, $message);

printDebug("savejpg()--[Filename too long]--[!addjpg $pre $url $jpgname $checksum]--[$nick]--[$channel]");

return 0;


my $jpg2 = stripBadCharsFile($jpgname);

my $url2 = stripBadCharsUrl($url);

# escape ( and ) chars

$jpg2 =~ s/\(/\\\(/g;

$jpg2 =~ s/\)/\\\)/g;

$url2 =~ s/\(/\\\(/g;

$url2 =~ s/\)/\\\)/g;

my $hash = md5_hex($pre);

my $botId = checkBot($nick, "jpg");

if (!$botId) {

printDebug("savejpg()--[Bot $nick does not have jpg saving rights]--[!addjpg $pre $url $jpgname $checksum]--[$nick]--[$channel]");

return 0;


if (checkIfPreExists($pre) != 1) {

my $message = "[".$red."ERROR".$reset."] ".$darkgrey."savejpg()--[No such pre in db]--[!addjpg $pre $url $jpgname $checksum]--[$nick]--[$channel]";

announceError($server, $message);

printDebug("savejpg()--[No such pre in db]--[!addjpg $pre $url $jpgname $checksum]--[$nick]--[$channel]");

return 0;


if ($pre) {

my $sql = "SELECT [login to view URL], [login to view URL], [login to view URL] FROM jpgs j LEFT JOIN releases AS r ON [login to view URL] = [login to view URL] WHERE [login to view URL] = ? and [login to view URL] = ? LIMIT 1";

my @params = ($pre, $jpgname);

if (runSqlSingle($sql, @params)) {

printDebug("saveJpg()--[Jpgs already exists]--[!addjpg $pre $url $jpgname $checksum]--[$nick]--[$channel]");

return 0;



printDebug("savejpg()--[!addjpg $pre $url $jpgname]--[$nick]--[$channel]--START--");

my $releaseId = getReleaseId($pre);

my $channelId = getChannelId($channel);

my $command = "wget -q -T 1 -t 1 --no-check-certificate --content-disposition -O $jpg2 $url2";


rename("$jpgname", "$hash");

my $filesize = -s "$hash";

if ($filesize < 10000 || $filesize > 4240000 ) {


printDebug("savejpg()--[Invalid filesize]--[!addjpg $pre $url $jpgname $checksum]--[$nick]--[$channel]");

return 0;


open(FILE, "$hash") or die $!;

my @data = <FILE>;

close FILE;

my $jpgdata = join('',@data);

$jpgdata = encode_base64($jpgdata);

my $sql = "INSERT INTO jpgs(releaseid, hash, jpg, jpgname, time, \

channelid, botid) VALUES (?, ?, ?, ?, ?, ?, ?)";

my @params = ($releaseId, $hash, $jpgdata, $jpgname, $time, $channelId, $botId);

if (!runSqlSave($sql, @params)) {

my $message = "[".$red."ERROR".$reset."] ".$darkgrey."savejpg()--[Unable to save jpg into db]--[!addjpg $pre $url $jpgname $checksum]--[$nick]--[$channel]";

announceError($server, $message);

printDebug("savejpg()--[Unable to save jpg into db]--[!addjpg $pre $url $jpgname $checksum]--[$nick]--[$channel]");


return 0;


Skills: Linux, MySQL, Perl, PHP, Shell Script

See more: resize jpg images java, resize jpg image, resize jpg cmd, freelance categories, freelance system administrator, it freelancing, online projects jobs, freelance job openings, freelancer jobs list, python freelance jobs, how to become a freelance python programmer, boutique online include resize jpg, resize jpg source code visual basic, excel vba resize jpg, resize jpg using vba code, code resize jpg, joomla myportfolio jpg quality, resize jpg command line, oscommerce jpg quality, upload resize jpg gif php

About the Employer:
( 1 review ) san gregorio di catania, Italy

Project ID: #16953034

4 freelancers are bidding on average €22 for this job


Hello More 20 years programming experience. I need more details to set real price and time. Regards. ----------------------------------------------------------------------------------------------------------------- More

€34 EUR in 3 days
(39 Reviews)
€23 EUR in 1 day
(11 Reviews)

Hi, Hope you are doing well! You need us design a WEBSITE for you AS you mentioned in your description A client is very important to us. Thus our prime motto has always been to satisfy each client. Also outso More

€15 EUR in 1 day
(5 Reviews)

A proposal has not yet been provided

€14 EUR in 2 days
(0 Reviews)