Changeset 72

Show
Ignore:
Timestamp:
11/11/06 00:51:53 (14 years ago)
Author:
exi
Message:

Changed portrait to only store 128x128.
class.http.php now returns false on no connect.
Changed siggen, added errorpicture, changed output to jpg, enabled possibility to use several signatures, added 2 signatures as more examples

Location:
dev
Files:
15 added
2 removed
3 modified

Legend:

Unmodified
Added
Removed
  • dev/common/class.http.php

    r57 r72  
    6868        $this->connect(); 
    6969        $fp = &$this->fp; 
     70 
     71        if (!is_resource($fp)) 
     72        { 
     73            return false; 
     74        } 
    7075 
    7176        // define a linefeed (carriage return + newline) 
  • dev/common/portrait.php

    r44 r72  
    2828} 
    2929 
    30 if (file_exists("cache/portraits/".$id."_512.jpg")) 
     30if (file_exists("cache/portraits/".$id."_128.jpg")) 
    3131{ 
    32     $img = imagecreatefromjpeg("cache/portraits/".$id."_512.jpg"); 
     32    $img = imagecreatefromjpeg("cache/portraits/".$id."_128.jpg"); 
    3333} 
    3434else 
    3535{ 
    36     $file = @file_get_contents("http://img.eve.is/serv.asp?s=512&c=".$id); 
     36    $file = @file_get_contents("http://img.eve.is/serv.asp?s=128&c=".$id); 
    3737    if ($img = imagecreatefromstring($file)) 
    3838    { 
    39         $fp = fopen("cache/portraits/".$id."_512.jpg", "w"); 
     39        $fp = fopen("cache/portraits/".$id."_128.jpg", "w"); 
    4040        fwrite($fp, $file); 
    4141        fclose($fp); 
     
    4747        require_once("class.http.php"); 
    4848 
    49         $url = "http://img.eve.is/serv.asp?s=512&c=".$id; 
     49        $url = "http://img.eve.is/serv.asp?s=128&c=".$id; 
    5050        $http = new http_request($url); 
    5151        $file = $http->get_content(); 
     
    5353        if ($img = imagecreatefromstring($file)) 
    5454        { 
    55             $fp = fopen("cache/portraits/".$id."_512.jpg", "w"); 
     55            $fp = fopen("cache/portraits/".$id."_128.jpg", "w"); 
    5656            fwrite($fp, $file); 
    5757        } 
     
    6262{ 
    6363    $newimg = imagecreatetruecolor($size, $size); 
    64     imagecopyresampled($newimg, $img, 0, 0, 0, 0, $size, $size, 512, 512); 
     64    imagecopyresampled($newimg, $img, 0, 0, 0, 0, $size, $size, 128, 128); 
    6565    imagejpeg($newimg, $portrait); 
    6666    header("Content-Type: image/jpeg"); 
     
    7070 
    7171// last try, we could not get a valid picture from the server 
    72 // so output a '!' 
    73 $portrait = "cache/portraits/0_".$size.".jpg"; 
     72// so output a red '!' 
     73$portrait = "img/portrait_0_".$size.".jpg"; 
    7474if (file_exists($portrait)) 
    7575{ 
  • dev/mods/signature_generator/sig.php

    r39 r72  
    66$sig_name = str_replace('.', '', $sig_name); 
    77$sig_name = str_replace('/', '', $sig_name); 
     8$sig_name = str_replace('/', '', $sig_name); 
    89 
    910if (!$plt_id = $_GET['i']) 
    1011{ 
     12    header('location: error.jpg'); 
    1113    exit; 
    1214} 
     
    1921if (!$pilot->exists()) 
    2022{ 
     23    header('Location: error.jpg'); 
    2124    exit; 
    2225} 
     
    2730if (ALLIANCE_ID && $alliance->getID() != ALLIANCE_ID) 
    2831{ 
     32    header('Location: error.jpg'); 
    2933    exit; 
    3034} 
    3135elseif (CORP_ID && $corp->getID() != CORP_ID) 
    3236{ 
     37    header('Location: error.jpg'); 
    3338    exit; 
    3439} 
    3540 
     41$id = abs(crc32($sig_name)); 
    3642// check for cached version 
    37 if (file_exists('cache/data/sig_'.$plt_id)) 
     43if (file_exists('cache/data/sig_'.$id.'_'.$plt_id)) 
    3844{ 
    39     $age = filemtime('cache/data/sig_'.$plt_id); 
     45    $age = filemtime('cache/data/sig_'.$id.'_'.$plt_id); 
    4046 
    4147    // cache files for 30 minutes 
    4248    if (time() - $age < 30*60) 
    4349    { 
    44         header('Content-Type: image/png'); 
    45         readfile('cache/data/sig_'.$plt_id); 
     50        header('Content-Type: image/jpg'); 
     51        readfile('cache/data/sig_'.$id.'_'.$plt_id); 
    4652        return; 
    4753    } 
     
    4955 
    5056// check template 
    51 if (!file_exists('mods/signature_generator/signatures/'.$sig_name.'.png')) 
     57if (!is_dir('mods/signature_generator/signatures/'.$sig_name)) 
    5258{ 
     59    header('Location: error.jpg'); 
    5360    exit; 
    5461} 
    55 $im = imagecreatefrompng('mods/signature_generator/signatures/'.$sig_name.'.png'); 
    5662 
    57 $red = imagecolorallocate($im, 255, 10, 10); 
    58 $orange = imagecolorallocate($im, 150, 120, 20); 
    59 $blue = imagecolorallocate($im, 0, 0, 200); 
    60 $white = imagecolorallocate($im, 255, 255, 255); 
    61 $black = imagecolorallocate($im, 0, 0, 0); 
     63require('mods/signature_generator/signatures/'.$sig_name.'/'.$sig_name.'.php'); 
    6264 
    63 $grey_trans = imagecolorallocatealpha($im, 50, 50, 50, 50); 
    64 $greyred_trans = imagecolorallocatealpha($im, 50, 10, 10, 50); 
    65  
    66 $name = $pilot->getName(); 
    67  
    68 $list = new KillList(); 
    69 $list->setOrdered(true); 
    70 $list->setLimit(1); 
    71 $list->setPodsNoobships(false); 
    72 $list->addInvolvedPilot($pilot); 
    73 $kill = $list->getKill(); 
    74  
    75 require('mods/signature_generator/settings/'.$sig_name.'.php'); 
    76  
    77 header('Content-Type: image/png'); 
    78 //imagepng($im); 
    79 imagepng($im, 'cache/data/sig_'.$plt_id); 
    80 readfile('cache/data/sig_'.$plt_id); 
     65header('Content-Type: image/jpg'); 
     66imagejpeg($im, 'cache/data/sig_'.$id.'_'.$plt_id, 95); 
     67readfile('cache/data/sig_'.$id.'_'.$plt_id); 
    8168?>