Re: Image resize problems



Hi Mike

I have the same code that is almost identical to what you show. (
variable name(s) are different ). Mine works so I know that the code
is okiedokie. What happens when you $ImageName =
imagecreatefromjpg(filepath/name.jpg), then save it as another
imagejpg($ImageName, filepath/othername.jpg)? Does this work?

Did you remember to load DB.php?
<?php
include_once("DB.php");

hope that helps

todh

mikeyatsony wrote:
Here is the code that I get the error with

<?php
// File and new size
$filename = 'test.jpg';
$percent = 0.5;

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

// Get new sizes
list($width, $height) = getimagesize($filename);
$newwidth = $width * $percent;
$newheight = $height * $percent;

// Load
$thumb = imagecreatetruecolor($newwidth, $newheight);
$source = imagecreatefromjpeg($filename);

// Resize
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight,
$width, $height);

// Output
imagejpeg($thumb);
?>

And this is the error I get
<br />
<b>Fatal error</b>: Call to undefined function:
imagecreatetruecolor() in
<b>/tmp/disk/home/webmaster/Files/WWW/image_test.php</b> on line
<b>15</b><br />

.



Relevant Pages

  • Re: [PHP] PHP Performance and System Load
    ... General performance tip do not include more than 10 files a page load. ... Uses php Adodb ... At the moment I am trying to lower the number of filesystem calls as ... over a symlink placed in every webspace directory. ...
    (php.general)
  • Re: High Scores
    ... If you want to view High scores it returns Could Not load scores ... here is the PHP script ... Edit the game Flash file to point to this file on your server ... >> And the PHP script is here ...
    (alt.php)
  • Re: about structure.
    ... Of course if you want to use a load of checkboxes, it works too, just modify ... I thought about using a database... ... "I thought about using php... ... server needs to call upon php... ...
    (alt.php)
  • Re: [PHP] Re: can a session be used in a query?
    ... I've noticed that I somtimes have to get the page to load ... What I normally do is upload a blank php page with the same name as the one ... This one pulls all data regardless of user level: ... the query UserName = $UserName I get an undefined variable error... ...
    (php.general)
  • Re: Loading png images into a mysql table/database
    ... I have decided to use PHP and MySQL. ... I can load jpeg files into the table ... I do a select from the database, and then echo the image (with ... header(Content Type: image/jpeg) ...
    (comp.lang.php)