i'm trying to make a php script to get a user picture but when i the returned image is empty, it should return the standard image. This is the code i have that does not work...
<?php
if (isset($_GET['user']))
{
$user = $_GET['user'];
$skinURL = "http://s3.amazonaws.com/MinecraftSkins/".$user.".png";
}
$debugImage = imagecreatefrompng("http://s3.amazonaws.com/MinecraftSkins/".$user.".png");
if (empty($debugImage)) // here it checks if $debugImage is empty (doesn't work)
{
$skinURL = 'http://www.minecraft.net/images/char.png';
}
$skin = imagecreatefrompng($skinURL);
?>
any ideas?
edit 1: The link returns a image if it exists, and nothing if it doesn't exist. Thanks already for the answers!