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 Link to comment https://forums.phpfreaks.com/topic/77827-gd-error-simple-fix/ 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? Link to comment https://forums.phpfreaks.com/topic/77827-gd-error-simple-fix/#findComment-393949 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.