root/dev/common/portrait_grab.php @ 10

Revision 10, 2.4 KB (checked in by exi, 14 years ago)

Changed portrait generation to cache the pictures from img.eve.is
Changed about-page-spacing
Changed MapView? to use PNG instead of GIF
Added BugCompat? to MapView? for the GD<>imagefilledellipse()-Issue
Added Code for NPC-Corphandling (Corps have to be added manually)
Changed Raw-Killmail Window slightly
Added Killmail-Delete option within the killmail itself
Fixed privilege bug between admin and superadmin
Removed the need to enter the postpassword if you're logged in as admin
Changed coding style to Allman/BSD in all touched files
Various small changes i cant remember

Line 
1<?php
2require_once("class.page.php");
3require_once("class.pilot.php");
4require_once("class.corp.php");
5require_once("class.alliance.php");
6
7$page = new Page("Capture portrait");
8
9$html .= "<html><head><title>Update portrait</title></head><body>";
10
11if (!$page->igb())
12{
13    $html .= "You need to access this page from the EVE ingame browser.";
14}
15else
16{
17    if (($_SERVER['HTTP_EVE_TRUSTED'] == 'no'))
18    {
19        Header('eve.trustme:http://' . $_SERVER['HTTP_HOST'] . '/::Need trust to grab character portrait.');
20        $html .= '<h1>Trust Required</h1>';
21        $html .= 'This site needs to be trusted in order to grab your character portrait.';
22    }
23    else
24    {
25        $now = date("Y-m-d H:m:s");
26
27        $alliance = new Alliance();
28        $all_id = $alliance->add($_SERVER['HTTP_EVE_ALLIANCENAME']);
29        $corp = new Corporation();
30        $crp_id = $corp->add($_SERVER['HTTP_EVE_CORPNAME'], $alliance, $now);
31        $pilot = new Pilot();
32        $plt_id = $pilot->add($_SERVER['HTTP_EVE_CHARNAME'], $corp, $now);
33        $pilot->setCharacterID($_SERVER['HTTP_EVE_CHARID']);
34        @unlink("cache/portraits/" . $_SERVER['HTTP_EVE_CHARID'] . "_32.jpg");
35        @unlink("cache/portraits/" . $_SERVER['HTTP_EVE_CHARID'] . "_64.jpg");
36        @unlink("cache/portraits/" . $_SERVER['HTTP_EVE_CHARID'] . "_128.jpg");
37        @unlink("cache/portraits/" . $_SERVER['HTTP_EVE_CHARID'] . "_512.jpg");
38        //$html .= "<img src=\"".$pilot->getPortraitURL(64).".jpg\" border=\"0\">";
39        $html .= "Character portrait updated !<br>";
40        $html .= "<a href=\"?a=igb\">Return</a><br>";
41
42        $updated = true;
43    }
44}
45
46$html .= "</body></html>";
47
48echo $html;
49if ($updated)
50{
51    flush();
52    ignore_user_abort(1);
53    $id = $_SERVER['HTTP_EVE_CHARID'];
54
55    $img = imagecreatefromjpeg("http://img.eve.is/serv.asp?s=512&c=".$id);
56    if ($img)
57    {
58        $newimg = imagecreatetruecolor(32, 32);
59        imagecopyresampled($newimg, $img, 0, 0, 0, 0, 32, 32, 512, 512);
60        imagejpeg($newimg, "cache/portraits/" . $id . "_32.jpg");
61        $newimg = imagecreatetruecolor(64, 64);
62        imagecopyresampled($newimg, $img, 0, 0, 0, 0, 64, 64, 512, 512);
63        imagejpeg($newimg, "cache/portraits/" . $id . "_64.jpg");
64        $newimg = imagecreatetruecolor(128, 128);
65        imagecopyresampled($newimg, $img, 0, 0, 0, 0, 128, 128, 512, 512);
66        imagejpeg($newimg, "cache/portraits/" . $id . "_128.jpg");
67    }
68}
69?>
Note: See TracBrowser for help on using the browser.