Jump to content


Photo

imagecreate


  • Please log in to reply
5 replies to this topic

#1 pvtpyro

pvtpyro
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 30 August 2006 - 03:56 AM

I made a script that creates an image. It makes the image just the way I want. comes out perfectly! but the imagedestroy($image); prevents me from being able to save the image. As of now the file saves as a filename.php.gif, but it's not actually a gif.

is there a function or something I can use to save the actual image on my server, then show it in the browser for people to see?

#2 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,020 posts

Posted 30 August 2006 - 06:43 AM

<?php
imagecreate ($x, $y);

  // image code


imagegif($im, $path_filename);  // output to file
imagedestroy($im);
?>

If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts

#3 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 30 August 2006 - 07:41 AM

<?php
imagecreate ($x, $y);

  // image code


imagegif($im, $path_filename);  // output to file
imagedestroy($im);
?>


using imagecreate can create a poor quality image
$image_p = imagecreatetruecolor($new_width, $new_height);

then
imagegif($image_p, $save_to, 75) //75 being the quality, i think 75 is a nice on
or
imagejpeg
or
imagepeng



Tell me the problem, I will try tell you the solution

#4 pvtpyro

pvtpyro
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 30 August 2006 - 03:18 PM

thank you so much!  :D

#5 pvtpyro

pvtpyro
  • Members
  • PipPip
  • Member
  • 12 posts

Posted 30 August 2006 - 03:34 PM

once i add imagename.gif after $image, the script stops working.  ???

#6 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 30 August 2006 - 04:55 PM

When you say create image, do u mean using other images, or adding lines ect

if using other images, here is code I use to blend images
<?php
$myimage = imagecreatefromjpeg("images/bground_img.jpg");
imagealphablending($map, 1);

$extra_img = imagecreatefromjpeg("second_img.jpg");
imagealphablending($extra_img, 1);

imagecopy($myimage, $extra_img, $x_loc, $y_loc, 0, 0, $width, $height);

imagejpeg($map, $save_to);
?>



Tell me the problem, I will try tell you the solution




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users