ここの情報は古いです。ご理解頂いた上でお取り扱いください。

Changeset 6887


Ignore:
Timestamp:
May 1, 2008, 2:20:05 AM (11 years ago)
Author:
ebihara
Message:

Storage, Generator に options を指定できるようにし、cache_dir 以外のプロパティを引き上げ

Location:
OpenPNE/branches/work/ebihara/prj_renew_OpenPNE_Img/webapp/lib/OpenPNE
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE/branches/work/ebihara/prj_renew_OpenPNE_Img/webapp/lib/OpenPNE/Img.php

    r6886 r6887  
    2222
    2323    // options
    24     var $dsn;
    2524    var $cache_dir;
    26     var $jpeg_quality = 75;
    2725
    2826    var $raw_img;
     
    4644        foreach ($options as $key => $value) {
    4745            switch ($key) {
    48             case 'dsn':
    49                 $this->dsn = $value;
    50                 break;
    51             case 'jpeg_quality':
    52                 $this->jpeg_quality = intval($value);
    53                 break;
    5446            case 'cache_dir':
    5547                $this->cache_dir = realpath($value);
     
    5850        }
    5951
    60         $this->generator = new OpenPNE_Img_Generator();
    61         $this->storage = new OpenPNE_Img_Storage();
     52        $this->generator = new OpenPNE_Img_Generator($options);
     53        $this->storage = new OpenPNE_Img_Storage($options);
    6254    }
    6355
     
    177169    function get_raw_img()
    178170    {
    179         return $this->storage->getRawImage($this->dsn, $this->requests['filename']);
     171        return $this->storage->getRawImage($this->requests['filename']);
    180172    }
    181173
  • OpenPNE/branches/work/ebihara/prj_renew_OpenPNE_Img/webapp/lib/OpenPNE/Img/Generator.php

    r6859 r6887  
    1818    var $output_format;
    1919
    20     function OpenPNE_Img_Generator()
    21     {
     20    function OpenPNE_Img_Generator($options = array())
     21    {
     22        if (!empty($options['jpeg_quality'])) {
     23            $this->jpeg_quality = $options['jpeg_quality'];
     24        }
    2225    }
    2326
     
    152155        case 'jpg':
    153156        default:
    154             imagejpeg($output_gdimg, $cache_fullpath, $this->jpeg_quality);
    155             break;
     157            imagejpeg($output_gdimg, $cache_fullpath, $this->jpeg_quality); break;
    156158        case 'gif':
    157159            imagegif($output_gdimg, $cache_fullpath);
  • OpenPNE/branches/work/ebihara/prj_renew_OpenPNE_Img/webapp/lib/OpenPNE/Img/Storage.php

    r6886 r6887  
    1515class OpenPNE_Img_Storage
    1616{
    17     function OpenPNE_Img_Storage()
     17    var $dsn;
     18
     19    function OpenPNE_Img_Storage($options = array())
    1820    {
     21        if (!empty($options['dsn'])) {
     22            $this->dsn = $options['dsn'];
     23        }
    1924    }
    2025
    21     function getRawImage($dsn, $filename)
     26    function getRawImage($filename)
    2227    {
    23         $db =& new OpenPNE_DB($dsn);
     28        $db =& new OpenPNE_DB($this->dsn);
    2429
    2530        $sql = 'SELECT bin, type FROM c_image WHERE filename = ?';
Note: See TracChangeset for help on using the changeset viewer.