| PHP Images... I can't make one. :( | 
| Author: | Message: | 
| Moo Full Member
 
    
 
  
 Posts: 395
 Reputation: 19
 Joined: Jun 2004
 
 |  | 
| 01-19-2005 12:07 AM |  | 
|  | 
| fluffy_lobster Veteran Member
 
      
 
  Posts: -2
 
 Posts: 1390
 Reputation: 23
 37 /
  /  Joined: Nov 2002
 
 | | RE: PHP Images... I can't make one. :( Link of the day: http://php.net/image 
Look at a basic function that you're likely to need such as imagecreate() and there are loads of examples that branch out to help you do what you want to do.
 
Failing that plenty of tutorials exist.  I suggest webmonkey | 
 | 
| 01-19-2005 04:51 PM |  | 
|  | 
| -dt- Scripting Contest Winner
 
      
 
  ;o
 
 Posts: 1818
 Reputation: 74
 37 /
  /  Joined: Mar 2004
 
 | | RE: PHP Images... I can't make one. :( after you can create an image with php + write text on it you will need to download the site you wish to parse into a varible a common (and semi good) way to do it is like code:<?
 $handle = fopen("http://www.bungie.net/Stats/PlayerStats.aspx?player=guyguyme2003", "rb");
 $contents = '';
 while (!feof($handle)) {
 $contents .= fread($handle, 8192);
 }
 fclose($handle);
 
 
 ?>
 
 (you can read about  
fopen here 
fread here 
fclose here 
) 
then $contents will hold the entire stat page which you will have to  parse and cache then print onto the image.
 
It shouldn't be too hard if you need any help pm me  something  This post was edited on 01-19-2005 at 05:35 PM by -dt-.
 ![[Image: dt2.0v2.png]](http://thedt.net/img/dt2.0v2.png) Happy Birthday, WDZ | 
 | 
| 01-19-2005 05:32 PM |  | 
|  | 
| Moo Full Member
 
    
 
  
 Posts: 395
 Reputation: 19
 Joined: Jun 2004
 
 | | O.P.  RE: PHP Images... I can't make one. :( Man! I suck! I cant get the image to work... all i see is a blank page! | 
 | 
| 01-19-2005 09:06 PM |  | 
|  | 
| WDZ Former Admin
 
      
 
  
 Posts: 7105
 Reputation: 107
 – /
  /  Joined: Mar 2002
 
 | | RE: PHP Images... I can't make one. :( quote:Originally posted by Guillaume
 Man! I suck! I cant get the image to work... all i see is a blank page!
 
 Well, what are you expecting to see? Did you make a script? | 
 | 
| 01-19-2005 09:12 PM |  | 
|  | 
| Moo Full Member
 
    
 
  
 Posts: 395
 Reputation: 19
 Joined: Jun 2004
 
 | | O.P.  RE: PHP Images... I can't make one. :( I put  code:<?php
 header("Content-type: image/png");
 $im = @imagecreate(100, 50)
 or die("Cannot Initialize new GD image stream");
 $background_color = imagecolorallocate($im, 255, 255, 255);
 $text_color = imagecolorallocate($im, 233, 14, 91);
 imagestring($im, 1, 5, 5,  "This will soon be replaced with something else.", $text_color);
 imagepng($im);
 imagedestroy($im);
 ?>
 
 | 
 | 
| 01-19-2005 09:19 PM |  | 
|  | 
| WDZ Former Admin
 
      
 
  
 Posts: 7105
 Reputation: 107
 – /
  /  Joined: Mar 2002
 
 | | RE: PHP Images... I can't make one. :( * WDZ saves the file on his local server and tries it
It works.    The text is cut off because of the small image width, but other than that, it's fine.
 
Are you trying it on a server that supports PHP & GD and doesn't have any dodgy stuff like forced advertisements? | 
 | 
| 01-19-2005 09:34 PM |  | 
|  | 
| Moo Full Member
 
    
 
  
 Posts: 395
 Reputation: 19
 Joined: Jun 2004
 
 | | O.P.  RE: PHP Images... I can't make one. :( i duno if GD is there...EDIT: For some reason, PHP doesn't work anymore.
 This post was edited on 01-19-2005 at 09:49 PM by Moo.
 | 
 | 
| 01-19-2005 09:36 PM |  | 
|  | 
| WDZ Former Admin
 
      
 
  
 Posts: 7105
 Reputation: 107
 – /
  /  Joined: Mar 2002
 
 | | RE: PHP Images... I can't make one. :( Hmm... well, you should move the header() line so it's right above the imagepng() line. If the script is outputting any text error messages, the browser might not display them because it's expecting a PNG image. Just for clarity, here's the modified code: code:<?php
 $im = @imagecreate(100, 50)
 or die("Cannot Initialize new GD image stream");
 $background_color = imagecolorallocate($im, 255, 255, 255);
 $text_color = imagecolorallocate($im, 233, 14, 91);
 imagestring($im, 1, 5, 5,  "This will soon be replaced with something else.", $text_color);
 header("Content-type: image/png");
 imagepng($im);
 imagedestroy($im);
 ?>
 
 | 
 | 
| 01-19-2005 09:42 PM |  | 
|  | 
| Moo Full Member
 
    
 
  
 Posts: 395
 Reputation: 19
 Joined: Jun 2004
 
 | | O.P.  RE: RE: PHP Images... I can't make one. :( quote:Originally posted by WDZ
 Hmm... well, you should move the header() line so it's right above the imagepng() line. If the script is outputting any text error messages, the browser might not display them because it's expecting a PNG image. Just for clarity, here's the modified code:
 
 
 code:<?php
 $im = @imagecreate(100, 50)
 or die("Cannot Initialize new GD image stream");
 $background_color = imagecolorallocate($im, 255, 255, 255);
 $text_color = imagecolorallocate($im, 233, 14, 91);
 imagestring($im, 1, 5, 5,  "This will soon be replaced with something else.", $text_color);
 header("Content-type: image/png");
 imagepng($im);
 imagedestroy($im);
 ?>
 
 
 Still a blank page... phpinfo() displays a blank page also. | 
 | 
| 01-19-2005 09:51 PM |  | 
|  | 
| Pages: (4): 
« First
  
 [ 1 ]
 2
 3
 4
 
»
 
Last » | 
|  |