|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2005-11-17 17:09 UTC] tony2001@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Dec 05 00:00:01 2025 UTC |
Description: ------------ Hi i have started using imagejpeg function from GD. However, when i produce the following code: <see below> It did not give save and overwrite my working image to a new image with a new size. please help me in this. Thanks Reproduce code: --------------- <?php // The file $filename = 'wew.jpg'; // Content type header('Content-type: image/jpeg'); // Get new dimensions list($width, $height) = getimagesize($filename); $new_width = 10; $new_height = 10; // 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); ?> Expected result: ---------------- I expected to see my file : "wew.jpg" to be of size 10 x 10 pixels. I realised that after trying my script for many times, i managed to get the file overwritten. It became a file of the same filename but of a new assigned size (10 x 10). Please help as i don't seem to make it work again. Actual result: -------------- Actual result is that the browser did show me the small (10x10) picture but the real wew.jpeg is still untouched. I want it to be affected by the php code.