35 | | if (file_exists("cache/portraits/".$id."_256.jpg") && 1 == $_REQUEST['force']) |
36 | | { |
37 | | // Remove just in case. |
38 | | @unlink("cache/portraits/".$id."}_32.jpg"); |
39 | | @unlink("cache/portraits/".$id."_64.jpg"); |
40 | | @unlink("cache/portraits/".$id."_128.jpg"); |
41 | | @unlink("cache/portraits/".$id."_256.jpg"); |
42 | | if (0 == create_portraits($id)) |
43 | | { |
44 | | $message = "Character portrait uploaded."; |
45 | | } |
46 | | else |
47 | | { |
48 | | $message = "Character portrait update failed."; |
49 | | } |
50 | | } |
51 | | elseif (file_exists("cache/portraits/".$id."_256.jpg")) |
52 | | { |
53 | | $message = "Character portrait not updated, as it already exists. <a href='".KB_HOST."?a=portrait_grab&force=1'>Click</a> to force an update."; |
54 | | } |
55 | | else |
56 | | { |
57 | | if (0 == create_portraits($id)) |
58 | | { |
59 | | $message = "Character portrait uploaded."; |
60 | | } |
61 | | else |
62 | | { |
63 | | $message = "Character portrait update failed."; |
64 | | } |
65 | | |
66 | | } |
67 | | $html .= "<img src='".$pilot->getPortraitURL(64)."' border='0' />"; |
68 | | $html .= "<br />$message <br />$port_error_msg <br />"; |
69 | | $html .= "<a href='".KB_HOST."?a=igb'>Return</a> to the killboard.<br />"; |
70 | | } |
| 35 | if (file_exists("cache/portraits/".$id."_256.jpg") && 1 == $_REQUEST['force']) |
| 36 | { |
| 37 | // Remove just in case. |
| 38 | @unlink("cache/portraits/".$id."_32.jpg"); |
| 39 | @unlink("cache/portraits/".$id."_64.jpg"); |
| 40 | @unlink("cache/portraits/".$id."_128.jpg"); |
| 41 | @unlink("cache/portraits/".$id."_256.jpg"); |
| 42 | if (0 == create_portraits($id)) |
| 43 | { |
| 44 | $message = "Character portrait uploaded."; |
| 45 | } |
| 46 | else |
| 47 | { |
| 48 | $message = "Character portrait update failed."; |
| 49 | } |
| 50 | } |
| 51 | elseif (file_exists("cache/portraits/".$id."_256.jpg")) |
| 52 | { |
| 53 | $message = "Character portrait not updated, as it already exists. <a href='".KB_HOST."?a=portrait_grab&force=1'>Click</a> to force an update."; |
| 54 | } |
| 55 | else |
| 56 | { |
| 57 | if (0 == create_portraits($id)) |
| 58 | { |
| 59 | $message = "Character portrait uploaded."; |
| 60 | } |
| 61 | else |
| 62 | { |
| 63 | $message = "Character portrait update failed."; |
| 64 | } |
| 65 | |
| 66 | } |
| 67 | $html .= "<img src='".$pilot->getPortraitURL(64)."' border='0' />"; |
| 68 | $html .= "<br />$message <br />$port_error_msg <br />"; |
| 69 | $html .= "<a href='".KB_HOST."?a=igb'>Return</a> to the killboard.<br />"; |
| 70 | } |
79 | | global $port_error_msg; |
80 | | if (1 != ini_get('allow_url_fopen')) { |
81 | | $port_error_msg = 'This web host does not allow PHP to create HTTP connections. Check allow_url_fopen.'; |
82 | | return -99; |
83 | | } |
84 | | if (! is_writable('cache/portraits/')) { |
85 | | $port_error_msg = 'The portraits directory is not writable. Please fix this.'; |
86 | | return -99; |
87 | | } |
| 79 | global $port_error_msg; |
| 80 | if (1 != ini_get('allow_url_fopen')) { |
| 81 | $port_error_msg = 'This web host does not allow PHP to create HTTP connections. Check allow_url_fopen.'; |
| 82 | return -99; |
| 83 | } |
| 84 | if (! is_writable('cache/portraits/')) { |
| 85 | $port_error_msg = 'The portraits directory is not writable. Please fix this.'; |
| 86 | return -99; |
| 87 | } |
89 | | $img = @imagecreatefromjpeg("http://img.eve.is/serv.asp?s=".IS_IMG_MAX."&c=".$id); |
90 | | if ($img) |
91 | | { |
92 | | $dims = array (32, 64, 128); |
93 | | foreach ($dims as $dim) { |
94 | | $newimg = @imagecreatetruecolor($dim,$dim); |
95 | | @imagecopyresampled($newimg, $img, 0,0,0,0,$dim,$dim,IS_IMG_MAX,IS_IMG_MAX); |
96 | | @imagejpeg($newimg, "cache/portraits/".$id."_".$dim.".jpg"); |
97 | | } |
98 | | @imagejpeg($img, "cache/portraits/" . $id . "_256.jpg"); |
99 | | $return = 0; |
100 | | } |
101 | | else |
102 | | { |
103 | | $port_error_msg = 'Attempting to create an image failed, and it was not because the directory was not writable.'; |
104 | | $return = -99; |
105 | | } |
106 | | return $return; |
| 89 | $img = @imagecreatefromjpeg("http://img.eve.is/serv.asp?s=".IS_IMG_MAX."&c=".$id); |
| 90 | if ($img) |
| 91 | { |
| 92 | $dims = array (32, 64, 128); |
| 93 | foreach ($dims as $dim) { |
| 94 | $newimg = @imagecreatetruecolor($dim,$dim); |
| 95 | @imagecopyresampled($newimg, $img, 0,0,0,0,$dim,$dim,IS_IMG_MAX,IS_IMG_MAX); |
| 96 | @imagejpeg($newimg, "cache/portraits/".$id."_".$dim.".jpg"); |
| 97 | } |
| 98 | @imagejpeg($img, "cache/portraits/".$id . "_256.jpg"); |
| 99 | $return = 0; |
| 100 | } |
| 101 | else |
| 102 | { |
| 103 | $port_error_msg = 'Attempting to create an image failed, and it was not because the directory was not writable.'; |
| 104 | $return = -99; |
| 105 | } |
| 106 | |
| 107 | if (filesize("cache/portraits/".$id."_256.jpg") == '3863') |
| 108 | { |
| 109 | $port_error_msg = 'CCP have not generated an image for you yet. Be patient.'; |
| 110 | } |
| 111 | return $return; |