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

Changeset 9537


Ignore:
Timestamp:
Dec 10, 2008, 12:43:10 PM (12 years ago)
Author:
ebihara
Message:

#3208:fixed the image generator doesn't generate non-resized image

Location:
OpenPNE3/plugins/sfImageHandlerPlugin/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • OpenPNE3/plugins/sfImageHandlerPlugin/trunk/lib/image/generator/sfImageGeneratorGD.class.php

    r9533 r9537  
    103103    }
    104104
     105    $info = array('f' => $this->format, 'w' => '', 'h' => '');
     106
     107    if (!$this->width && !$this->height)
     108    {
     109      $this->outputImage = $sourceImage;
     110      return $info;
     111    }
     112
    105113    $source = array(imagesx($sourceImage), imagesy($sourceImage));
    106114    $want = array($this->width, $this->height);
    107115    $output = $this->calcOutputImageSize($source, $want);
    108116
    109     $info = array('w' => $this->width, 'h' => $this->height, 'f' => $this->format);
     117    $info['w'] = $this->width;
     118    $info['h'] = $this->height;
    110119
    111120    if (!$this->isNeedResize($source, $output))
  • OpenPNE3/plugins/sfImageHandlerPlugin/trunk/lib/image/sfImageHandler.class.php

    r9533 r9537  
    4646    $info = $this->generator->resize($contents, $this->storage->getImageFormat());
    4747
    48     $filename = sprintf('%s/cache/img/%s/%d.%d/%s.%2$s', sfConfig::get('sf_web_dir'), $info['f'], $info['w'], $info['h'], $this->options['filename']);
     48    $filename = sprintf('%s/cache/img/%s/w%s_h%s/%s.%2$s', sfConfig::get('sf_web_dir'), $info['f'], $info['w'], $info['h'], $this->options['filename']);
    4949    return $this->generator->output($filename);
    5050  }
  • OpenPNE3/plugins/sfImageHandlerPlugin/trunk/lib/sfImageHandlerRouting.class.php

    r9533 r9537  
    77    $routing->prependRoute('image',
    88      new sfRoute(
    9         '/cache/img/:format/:width.:height/:filename.:noice',
     9        '/cache/img/:format/:width_:height/:filename.:noice',
    1010        array(
    1111          'module' => 'image',
     
    1313        ),
    1414        array(
    15           'filename' => '^[a-zA-Z0-9_\.\-]+$',
     15          'filename' => '^[\w\d_\.\-]+$',
    1616          'format'   => '^(jpg|png|gif)$',
    17           'width'    => '^[0-9]+$',
    18           'height'   => '^[0-9]+$',
     17          'width'    => '^w[0-9]*$',
     18          'height'   => '^h[0-9]*$',
    1919          'noice'   => '^(jpg|png|gif)$',
     20        ),
     21        array(
     22          'segment_separators' => array('_', '/', '.'),
     23          'variable_regex' => '[a-zA-Z0-9]+',
    2024        )
    2125    ));
  • OpenPNE3/plugins/sfImageHandlerPlugin/trunk/modules/image/actions/actions.class.php

    r9533 r9537  
    2525      'filename' => $request->getParameter('filename', null),
    2626      'format'   => $request->getParameter('format', null),
    27       'width'    => $request->getParameter('width', null),
    28       'height'   => $request->getParameter('height', null),
     27      'width'    => str_replace('w', '', $request->getParameter('width', null)),
     28      'height'   => str_replace('h', '', $request->getParameter('height', null)),
    2929    );
    3030    $image = new sfImageHandler($params);
Note: See TracChangeset for help on using the changeset viewer.