Jump to content

ItsMeKam59

New Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by ItsMeKam59

  1. Oh yes, it works! I think I mistook something, thanks !
  2. Here's the FULL code (I have cancelled all the wrong things since Cronix's answer) : <?php //// BEGIN CONSTANTS //// // coordinates for the skin's face $face_x = 8; $face_y = 8; $face_width = 8; $face_height = 8; // coordinates for the skin's "mask", i.e. the layer that is overlaid // on top of the face $mask_x = 40; $mask_y = 8; $mask_width = 8; $mask_height = 8; // size of the output image $avatar_width = 96; $avatar_height = 96; // The default skin. All hail Steve! $default_skin_url = 'http://halcyon-pvp.fr/dl/img/char.png'; //// END CONSTANTS //// $image = $default_skin_url; //used as default if (isset($_GET['user'])) { //is the user set? $user = $_GET['user']; //Does the user image exist on site A? $site_a = "http://halcyon-pvp.fr/skins/$user.png"; $site_b = "http://skins.minecraft.net/MinecraftSkins/$user.png"; if (file_get_contents($site_a) !== FALSE) $image = $site_a; else if (file_get_contents($site_b) !== FALSE) $image = $site_b; } $skin = imagecreatefrompng($image); // Set up a blank image to write to $avatar = imagecreatetruecolor($avatar_width, $avatar_height); // Resize and overlay the face region, as defined by the constants above imagecopyresized($avatar, $skin, 0, 0, $face_x, $face_y, $avatar_width, $avatar_height, $face_width, $face_height); // Resize and overlay the mask region imagecopyresized($avatar, $skin, 0, 0, $mask_x, $mask_y, $avatar_width, $avatar_height, $mask_width, $mask_height); // Finally, return the processed image as a png header('Content-Type: image/png'); imagepng($avatar); imagedestroy($avatar); ?> It maybe comes cause of the Resize or the Header ? You could try the code, drop this code on a file like skin.php, drag in on your FTP, and try "http://yoursite.com/skin.php?user=AxploOdee" It's the site_a, the Head will Appears To try the site_b write "http://yoursite.com/skin.php?user=Ewearys" To try the defaut, write the name of your choice. The AxploOdee image exists on the site_a, and Ewearys on the site_b
  3. If i do this, it directly goes on the default image It didn't worked
  4. I fixed the errors, but this code don't work, there are many errors with the imagecopyresized (bottom of the code) This code just work for the site_a, but when It should checks the site_b and the default, it says me : Warning: file_get_contents(http://halcyon-pvp.fr/skins/Blabla.png): failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /home/halcyonp/public_html/skinHead.php on line 31 Warning: Cannot modify header information - headers already sent by (output started at /home/halcyonp/public_html/skinHead.php:31) in /home/halcyonp/public_html/skinHead.php on line 77 ‰PNG IHDR``múàoÏIDATxœíÜ1JAFáÉîHŒ&õb!6±ðÚÚ ^@ˆ…­…Bì¯ ØÚÚ‰x‹ØY¦PlD!wõoÀ ßWÿ¸ËsšÁ˜ÚùÑN ƒá'n^>†¸©Ê 7£q‰›rÌïó•ð¬µ•%Üd¸øçbk®Ž£Ç·wÜdY>‰÷ ³ ›Qàwïk·ý'Üx‚€€€€€€€€€€@ì?¿â(ßü“j O›Âûš'Ä<ðgùBÎS>8÷5O0000000000ˆ1%Qõw÷µƒí ~Ôê.nš­&nö;ë¸ñ˜åüw¨øû4RîkÝÎfÊ;¡…oîîpÓ^nãÆb}&âˆÿ«*„³Ó+ÜìmMæ.¶8Ͽע(psqØÁ'Äf£•0à¢wyüû·IÔ»ægU7'¸Iù®~O0000000000øMÀEÿ+G4¯IEND®B`‚ It doesn't go on the others links, it stays on the site_a
  5. It's almost the same code, i just added (file_exists and added the $user above the if to store properly the code
  6. How could I indicate a condition so ? Because I tried this : if(isset($_GET['user'])) { $user = htmlspecialchars($_GET['user']); } if (file_exists("http://halcyon-pvp.fr/skins/$user.png")) { $skin = @imagecreatefrompng("http://halcyon-pvp.fr/skins/$user.png"); } elseif(file_exists("http://skins.minecraft.net/MinecraftSkins/$user.png")) { $skin = @imagecreatefrompng("http://skins.minecraft.net/MinecraftSkins/$user.png"); } else { $skin = imagecreatefrompng($default_skin_url); } It sets the default image directly, or the file exists
  7. You didn't understood I think, it want : -if the file exists on http://abc.com, it gets it -if the if is false, it gets the file on http://othersite.com -if the both sites don't have any file, it sets a default image I will do this, wait
  8. That what I want to do, if the IF is false, it goes at the Elseif, and if the Elseif is false, it goes at the else It didn't worked I want to check if the PNG is in the first link, if false, it checks on the second link, if it's a second time false, it sets a default image
  9. Hello, I have a problem with my code : <?php //// BEGIN CONSTANTS //// // coordinates for the skin's face $face_x = 8; $face_y = 8; $face_width = 8; $face_height = 8; // coordinates for the skin's "mask", i.e. the layer that is overlaid // on top of the face $mask_x = 40; $mask_y = 8; $mask_width = 8; $mask_height = 8; // size of the output image $avatar_width = 96; $avatar_height = 96; // The default skin. All hail Steve! $default_skin_url = 'http://halcyon-pvp.fr/dl/img/char.png'; //// END CONSTANTS //// // Try to load the user's skin from the Amazon S3 storage if (isset($_GET['user'])) { $user = $_GET['user']; $skin = @imagecreatefrompng("http://halcyon-pvp.fr/skins/$user.png"); } if (!$skin) { // If skin could not be retrieved, display Steve $skin = imagecreatefrompng($default_skin_url); } // Set up a blank image to write to $avatar = imagecreatetruecolor($avatar_width, $avatar_height); // Resize and overlay the face region, as defined by the constants above imagecopyresized($avatar, $skin, 0, 0, $face_x, $face_y, $avatar_width, $avatar_height, $face_width, $face_height); // Resize and overlay the mask region imagecopyresized($avatar, $skin, 0, 0, $mask_x, $mask_y, $avatar_width, $avatar_height, $mask_width, $mask_height); // Finally, return the processed image as a png header('Content-Type: image/png'); imagepng($avatar); imagedestroy($avatar); ?> Here's the problem : if (isset($_GET['user'])) { $user = $_GET['user']; $skin = @imagecreatefrompng("http://halcyon-pvp.fr/skins/$user.png"); } if (!$skin) { // If skin could not be retrieved, display Steve $skin = imagecreatefrompng($default_skin_url); } The code works properly, but I want to add a new if, so i wrote this : if (isset($_GET['user'])) { $user = $_GET['user']; $skin = @imagecreatefrompng("http://halcyon-pvp.fr/skins/$user.png"); } elseif (isset($_GET['user'])) { $user = $_GET['user']; $skin = @imagecreatefrompng("http://skins.minecraft.net/MinecraftSkins/$user.png"); } else (!$skin) { // If skin could not be retrieved, display Steve $skin = imagecreatefrompng($default_skin_url); } But it doesn't work Could someone help me ? Thanks !
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.