What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » PHP Images... I can't make one. :(

Pages: (4): « First [ 1 ] 2 3 4 » Last »
PHP Images... I can't make one. :(
Author: Message:
Moo
Full Member
***

Avatar

Posts: 395
Reputation: 19
Joined: Jun 2004
O.P. Sad  PHP Images... I can't make one. :(
Can someone help me make a Halo 2 stat picture? The stats are at http://www.bungie.net/Stats/PlayerStats.aspx?player=guyguyme2003 .
I would like to have it look like http://guillaumelforum.theglassprison.net/halo2/s...rName=guyguyme2003 and I would like to see the clan stats too (link is on my stats page... take it from there, as it will change)

Thanks!

This post was edited on 01-19-2005 at 12:08 AM by Moo.
01-19-2005 12:07 AM
Profile E-Mail PM Find Quote Report
fluffy_lobster
Veteran Member
*****

Avatar
Posts: -2

Posts: 1391
Reputation: 23
36 / Male / Flag
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
Profile E-Mail PM Web Find Quote Report
-dt-
Scripting Contest Winner
*****

Avatar
;o

Posts: 1819
Reputation: 74
36 / Male / Flag
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 :P

This post was edited on 01-19-2005 at 05:35 PM by -dt-.
[Image: dt2.0v2.png]      Happy Birthday, WDZ
01-19-2005 05:32 PM
Profile PM Web Find Quote Report
Moo
Full Member
***

Avatar

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
Profile E-Mail PM Find Quote Report
WDZ
Former Admin
*****

Avatar

Posts: 7106
Reputation: 107
– / Male / Flag
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
Profile PM Web Find Quote Report
Moo
Full Member
***

Avatar

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
Profile E-Mail PM Find Quote Report
WDZ
Former Admin
*****

Avatar

Posts: 7106
Reputation: 107
– / Male / Flag
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
Profile PM Web Find Quote Report
Moo
Full Member
***

Avatar

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
Profile E-Mail PM Find Quote Report
WDZ
Former Admin
*****

Avatar

Posts: 7106
Reputation: 107
– / Male / Flag
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
Profile PM Web Find Quote Report
Moo
Full Member
***

Avatar

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
Profile E-Mail PM Find Quote Report
Pages: (4): « First [ 1 ] 2 3 4 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On