Changeset 72 for dev/common/portrait.php

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

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • 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{