Resize image during upload

Resize images during upload. I'm using RSComments. This component has the ability to upload an image with every comment.

In the file controller.php there's a function that does the uploading: function uploadfile() (line 95 - line 181).
In this function there must be a check if the imagefile is wider than 500px and if so, scale it back to 500px. I think it is important you have a good understanding of how Joomla 2.5 works. So please check the attachements to make sure this job is suited for you. Attached are the actual php page controller.php and the component itself.

Example of what lies ahead of you:

[part of the function uploadfile()]
$dest = $uploadFolder.$filename.'.'.$ext;

JFile::upload($src, $dest);
[/part of the function uploadfile()]

Should become something like:

[part of the function uploadfile()]
$dest = $uploadFolder.$filename.'.'.$ext;

list ($width) = getimagesize($src);

if ($width > 500) {

$newWidth = 500;

list($startWidth, $startHeight) = getimagesize($src);
$newHeight = $startHeight * (500 / $startWidth);
$newHeight = (int) $newHeight;

$src2 = imagecreatefromjpeg($filename);
$thumb = imagecreatetruecolor($newWidth, $newHeight);

// Resize
imagecopyresized($thumb, $src2, 0, 0, 0, 0, $newWidth, $newHeight, $startWidth, $startHeight);

imagejpeg($thumb, $src2, 0, 0, 0, 0, $newWidth, $newHeight, $startWidth, $startHeight);

JFile::upload($src2, $dest);
} else {

JFile::upload($src, $dest);

[/part of the function uploadfile()]

tried it, but it didn't work ;-))

Skills: Joomla, PHP

See more: resize-the-images, resize images, images resize, image-resize, image resize, image upload resize upload php, image upload component joomla, comment image, component upload, resize upload image, resize images php, php resize upload image, image php resize, image resize joomla upload, images resize upload, joomla component upload image resize, php resize image, upload resize images php, upload php joomla, upload image resize php, upload image resize joomla, upload image resize image php, upload image php resize, upload image joomla component, resize php

About the Employer:
( 0 reviews ) Haarlem, Netherlands

Project ID: #2512913

14 freelancers are bidding on average $74 for this job


Please check PMB

$75 USD in 1 day
(343 Reviews)

Details in PMB

$50 USD in 0 days
(154 Reviews)

Full time freelance web developer with over 8 years of commercial experience.

$50 USD in 2 days
(87 Reviews)

please check your pmb

$30 USD in 1 day
(92 Reviews)

Hi,I'm ready to help you now.

$50 USD in 1 day
(96 Reviews)

Hello, we are a group of programmers based in Sheffield, UK offering 7 years experience in php, .net, c#, jquery, css, python and c++. I am proposing to carry out tasks required for this project and deliver it within 2 More

$30 USD in 0 days
(26 Reviews)

I am ready sir.

$30 USD in 0 days
(14 Reviews)

Hello dear Friend, Greeting from our side is new for us but we are regular bidder on [login to view URL] We also gained 6 client reviews on scriptlance. we are expert in web development (specially in jo More

$30 USD in 2 days
(14 Reviews)

Hi, We are expert in this field and would like to assure you that we can fix this issue in a short time frame. Thanks Vicky

$55 USD in 1 day
(3 Reviews)

experienced jquery and php developer. Ready to do your project. Will deliver quality and reliable code. Thanks

$100 USD in 0 days
(6 Reviews)

I am ready for your work check your PM please.

$250 USD in 10 days
(0 Reviews)

HELLO SIR, I am ready to do this task for and I have read all the description of the project.I have very strong portfolio.I have finalized many projects of this type for my UK and USA clients.I prefer quality and my More

$50 USD in 4 days
(0 Reviews)

Hello, I am ready! So let's start!

$30 USD in 1 day
(0 Reviews)

Hello there, This task not new for us...We can full-fill your all requirement ... For more details please check PMB for your reference ...... Thanks

$33 USD in 1 day
(0 Reviews)

Dear Sir, Greetings! We are Reform Consulting with 5 year of experience under our belt. We are really interested to work on your project. Please see PM. Thank you. Regards, RCPL.

$200 USD in 10 days
(3 Reviews)