Blaine0002 Posted November 18, 2007 Share Posted November 18, 2007 So im working on a dynamic signature script, by pulling halo 3 stats off bungie.net and applying them to an image and cacheing the image. <?php $url = 'http://www.bungie.net/Stats/Halo3/Default.aspx?player=lazydonkey2'; $page = file_get_contents($url);<?php $url = 'http://www.bungie.net/Stats/Halo3/Default.aspx?player=lazydonkey2'; $page = file_get_contents($url); preg_match('/<li><h3>(.*?) - /', $page, $name); preg_match('/id="ctl00_mainContent_identityStrip_lblRank">(.*?)<\/span>/', $page, $rank); preg_match('/id="ctl00_mainContent_identityStrip_lblSkill">(.*?)<\/span>/', $page, $level); preg_match('/id="ctl00_mainContent_identityStrip_EmblemCtrl_imgEmblem" src="([^\"]+)/', $page, $icon); $url = "http://www.bungie.net" . $icon[1]; $url = str_replace("&","&",$url); $img = getimagesize($url) or die(); if ( $img[2] == 1 ) { $icon = imagecreatefromgif( $url ) or die(); } elseif ( $img[2] == 2 ) { $icon = imagecreatefromjpeg( $url ) or die(); } elseif ( $img[2] == 3 ) { $icon = imagecreatefrompng( $url ) or die(); } else {exit();} $image = imagecreatefrompng("sigs/1.png"); $x = imagesx($icon); $y = imagesy($icon); $px = ((200-$x)/2); $py = 15; $font = 4; $black = imagecolorallocate($image, 0, 0, 0); imagestring($image, $font, 165, 15, $name[1], $black); imagestring($image, $font, 165, 35, $rank[1], $black); imagestring($image, $font, 165, 55, "Highest Level: " . $level[1], $black); imagecopymerge($image, $pic, $px, $py, 0, 0, $x, $y, 100); header('Content-type: image/png'); imagepng($image); imagedestroy($image); i think there could be 2 things wrong with this.. Im not sure if gd is recognising the image im telling them, as it does not have a file extension. Does this mater? you can save it as a .jpg file tho so thats what i think it would pick it up as. Second thing i think could be wrong is i was told i might need to use fopen() to open remote urls... i do have that remote fopen thing activated in my php.ini Thanks for your help as im new to gd Quote Link to comment Share on other sites More sharing options...
Blaine0002 Posted November 18, 2007 Author Share Posted November 18, 2007 i figured out i need to use the $icon_data = fread($icon, 10000000); fclose($icon); to read the data. Still dosent work, is it because im putting a jpg onto a png? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.