php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35265 imagejpeg does not save image
Submitted: 2005-11-17 17:05 UTC Modified: 2005-11-17 17:09 UTC
From: hyperila at hotmail dot com Assigned:
Status: Not a bug Package: GD related
PHP Version: 5.0.5 OS: windows xp
Private report: No CVE-ID: None
 [2005-11-17 17:05 UTC] hyperila at hotmail dot com
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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-11-17 17:09 UTC] tony2001@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Try to read imagejpeg() docs?
http://php.net/imagejpeg
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 29 07:01:34 2024 UTC