mediaãã©ã°ã¤ã³å¿ç¨(5) ç»åã®åºåè¨å®
mediaãã©ã°ã¤ã³ã§ãVersionãã¡ã¤ã«ã®è¨å®ã¯core.phpã«è¨å®ãã¾ãããå®éã«ã©ã®ããã«è¨å®ããã°ããã®ãã主ãªä¾ãã¾ã¨ãã¾ããã
ãã©ã°ã¤ã³å´ã®config/core.phpãæ¹ä¿®ãããã
bootstrap.phpã§mediaãã©ã°ã¤ã³ã®core.phpãèªã¿è¾¼ãã å¾ã§ãConfigureè¨å®ä¸æ¸ãã§å¤æ´ãã¾ãã
è¨å®ã®èª¬æ
- ãã¼ï¼'xxs'ã'xl')
è¨å®åãä»»æã§è¨å®ãå¢ããäºãå¯è½(è¦ãviewã½ã¼ã¹ã®æ¹ä¿®ï¼
- 'convert' => $MimeType
$MimeTypeå½¢å¼ã§åºå
- 'fitCrop' => array($width, $height)
å¹ $width, é«ã$height(px)ã«ç¸®å°/æ¡å¤§ãã¦ããªãã³ã°ï¼åç»ã®å¹ ãé«ãã®é·ãæ¹ãã«ããï¼
- 'fit' => array($width, $height)
å¹ $width, é«ã$height(px)ã«ç¸®å°ï¼ã¢ã¹ãã¯ãæ¯ä¿æãåç»ã®å¹ ãé«ãã®é·ãæ¹ãè¨å®å¤ä»¥å ã«ç¸®å°ï¼
- 'fitOutside' => array($width, $height)
å¹ $width, é«ã$height(px)ã«ç¸®å°ï¼ã¢ã¹ãã¯ãæ¯ä¿æãåç»ã®å¹ ãé«ãã®çãæ¹ãè¨å®å¤ä»¥å ã«ç¸®å°ï¼
- 'zoomCrop' => array($width, $height)
ç»åã®ä¸å¿ããå¹ $width, é«ã$height(px)ã§ããªãã³ã°
-
- $width x $heightæå®ããå°ããç»åã«æå®ããå ´åãæ£ãã表示ãããªãã±ã¼ã¹ãããããã§ã*1ã
- 'compress' => $compress
å§ç¸®çã0ã10ã§æå®ãæå®ãªãå ´å1.5ã
-
- jpegç¨ã®æå®
è¨å®ä¾
app/config/bootstrap.php
/* media plugin */ require_once(APP.'plugins'.DS.'media'.DS.'config'.DS.'core.php'); /* Uploadç»ååºåãµã¤ãºãªã©ã®è¨å® */ require_once ('conf/upfile.php');
app/config/conf/upfile.php
<?php /* ç»å */ Configure::write('Media.filter.image', array( 'xxs' => array('convert' => 'image/png', 'fitCrop' => array(16, 16)), 'xs' => array('convert' => 'image/png', 'fitCrop' => array(32, 32)), 's' => array('convert' => 'image/png', 'zoomCrop' => array(64, 64)), 'm' => array('convert' => 'image/png', 'fit' => array(120, 120)), 'l' => array('convert' => 'image/png', 'fit' => array(180, 180)), 'bg' => array('convert' => 'image/png', 'fitOutside' => array(600, 450)), ));
*1:詳細ä¸æ