I looked around for some time and located some really perplexing and complex items that I could not make a start.

I am using chronoforms with joomla to create a form by having an upload file script, also it uploads the look towards the server without any problems, to date so great.

I have to go ahead and take submitted image and re-size it, even better, it is possible to method to re-size the look before uploading it towards the server?


Check this out link. Pretty easy stuff:


[This situation] is what you're searching for1.

// The file
$filename = 'test.jpg';
$percent = 0.5;

// Content type
header('Content-Type: image/jpeg');

// Get new dimensions
list($width, $height) = getimagesize($filename);
$new_width = $width * $percent;
$new_height = $height * $percent;

// Resample
$image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);

// Output
imagejpeg($image_p, null, 100);

I have tried personally PHPThumb for any couple of of my projects and located simple to use to utilize and it has a little resource footprint. Read the paperwork for more information, but is fairly easy:

$thumb = PhpThumbFactory::create('/path/to/source/image.png');

$thumb->resize(100, 100);