Help with GD and Bungie's ASHX Images.

mixmax2

RedArmyGangsta
Reaction score
31
So, I have this script that gets a bunch of information about a player's stats, it gets things like rank, exp, level, kills, deaths, games played. I then take that information and slap it into a nice gif image using the GD Library. An example of some sigs can be viewed at www.mixjah-design.com/sigs.php

Now, what I want is to beef my script up a bit, and add the player's Avatar, and Player Model, both are .Ashx Generated Images from Bungie.

Example of Avatar Image: http://www.bungie.net/Stats/halo2emblem.ashx?s=70&0=18&1=27&2=3&3=10&fi=52&bi=1&fl=1&m=1

Example of Player Model Image:
http://www.bungie.net/Stats/Halo3/PlayerModel.ashx?p1=0&p2=5&p3=5&p4=5&p5=7&p6=18&p7=18&p8=18

And Here's what my script looks like when it creates the signature image, the script that grabs the data isn't important, but know that it fetches the exact url to both the Avatar, and the Player Model Generated Images.

PHP:
$playername= 'Zero50';
include("siggrabber.php");
header ("Content-type: image/gif");
$image = imagecreatetruecolor(400, 80);
$image2 = @ImageCreateFromGIF ("images/halo3/sig/zero50/sig1template.gif");
$image3 = @ImageCreateFromGIF ("images/halo3/h3ranks/".$imagegrab.".gif");
//$image4 = @ImageCreateFrom??? ("ASHXIMG's URL");
$txt_color1 = ImageColorAllocate ($image, 255, 255, 255); 
imagefilledrectangle($image, 0, 0, 399, 79, $txt_color1);
imagecopymerge ($image, $image2, 0, 0, 0, 0, 400, 80, 100);
imagecopyresized ($image, $image3, 110, 5, 0, 0, 48, 72, 60, 90);
//imagecopyresized ($image, $image4, 74, 53, 0, 0, 19, 19, 70, 70);
ImageString ($image, 2, 234, 6,  $level, $txt_color1);
ImageString ($image, 2, 234, 17,  $tkills, $txt_color1);
ImageString ($image, 2, 234, 28,  $tdeaths, $txt_color1);
ImageString ($image, 2, 234, 39,  $tkd, $txt_color1);
ImageString ($image, 2, 234, 50,  $tgames, $txt_color1);
ImageGIF ($image, "images/halo3/sig/zero50/sig1.gif");

Now Here is the Problem I'm facing, as you can see there are 2 lines of code as comments, those are the 2 pieces I'm hoping to use for the avatar/player model image addition, this specific user's code only wants the avatar image. Now @ImageCreateFrom??? ("ASHXIMG"); Is the Part where I have some trouble, GD has some nice calls like ImageCreateFromGIF, JPG, PNG, and a few others, but what if I need it to get this Generated .ashx image?

Any help would be great, thankyou.
 

phyrex1an

Staff Member and irregular helper
Reaction score
447
Content-Type image/jpeg

.aspx is just another file ending, exactly like .html, .php or .asp. It's the content type that's important, or even more precisely the the format the content is in.

You can use the ImageCreateFromJPG function.
 

mixmax2

RedArmyGangsta
Reaction score
31
Well, I need the content type of the image to be a GIF, any possible way for me to do it with that?
 

DDRtists

ɹoʇɐɹǝpoɯ ɹǝdns
Reaction score
415
Content-type: image/jpeg
However, I have to warn you, you have a high chance of getting your IP banned from Bungie.net if you "bot" so to speak, their site. Most companies don't really enjoy 3rd party people taking info from their site. ;)

EDIT: That image is a .jpeg. Just open it as if it was.
 

mixmax2

RedArmyGangsta
Reaction score
31
Alright ty, new question, Howdo I convert a jpeg image into a gif image directly through php script, is it possible? (It's not as simple as changing the file extensions.)
 

mixmax2

RedArmyGangsta
Reaction score
31
I tried in the past to do ImageCreateFromJPEG, and then just turn it into a GIF like that, but it doesn't work, when I try to use the image "created from jpeg" and merge it onto the base image, it gives me an invalid image resource error.
 

mixmax2

RedArmyGangsta
Reaction score
31
yes, I did some searching and as it turns out you cannot use jpg image functions with the content header as gif. Oh well :(
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top