Changeset 9187
- Timestamp:
- 2006/11/27 19:11:21 (20 years ago)
- Location:
- temp/trunk
- Files:
-
- 2 edited
-
data/class/SC_Image.php (modified) (4 diffs)
-
html/test/kakinaka/resize_image.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
temp/trunk/data/class/SC_Image.php
r9186 r9187 53 53 54 54 // ³ÈÂçΨ¤ò»ØÄꤷ¤Æ²èÁüÊݸ 55 function saveResizeImage($file, $ zip_scale= 1, $header = false) {55 function saveResizeImage($file, $to_w = 1, $to_h = 1, $header = false) { 56 56 // ¥Ç¥£¥ì¥¯¥È¥ê¼èÆÀ 57 57 $dir = dirname($file); 58 58 59 59 // ¸µ²èÁü¥µ¥¤¥º¤ò¼èÆÀ 60 list($src_w, $src_h) = getimagesize($file); 61 60 list($from_w, $from_h) = getimagesize($file); 61 62 // Éý¤Î½Ì¾®Î¨ 63 ($to_w < $from_w) ? $wscale = $to_w / $from_w : $wscale = 1; 64 // ¹â¤µ¤Î½Ì¾®Î¨ 65 ($to_h < $from_h) ? $hscale = $to_h / $from_h : $hscale = 1; 66 // ½Ì¾®Î¨¤Ï¾®¤µ¤¤¤Û¤¦¤Ë¤¢¤ï¤»¤ë 67 ($wscale < $hscale) ? $scale = $wscale : $scale = $hscale; 68 62 69 // °µ½ÌΨ»ØÄê 63 $zip_width = $ src_w * $zip_scale;64 $zip_height = $ src_h * $zip_scale;70 $zip_width = $from_w * $scale; 71 $zip_height = $from_h * $scale; 65 72 66 73 // ¥Õ¥¡¥¤¥ë¤Î³ÈÄ¥»Ò¼èÆÀ … … 85 92 // °µ½ÌÀè²èÁü 86 93 $dst_im = imagecreatetruecolor($zip_width, $zip_height); 87 imagecopyresampled($dst_im, $src_im, 0, 0, 0,0, $zip_width, $zip_height, $ src_w, $src_h);94 imagecopyresampled($dst_im, $src_im, 0, 0, 0,0, $zip_width, $zip_height, $from_w, $from_h); 88 95 89 96 // ²èÁü½ÐÎÏ … … 102 109 // °µ½ÌÀè²èÁü 103 110 $dst_im = imagecreatetruecolor($zip_width, $zip_height); 104 imagecopyresampled($dst_im, $src_im, 0, 0, 0,0, $zip_width, $zip_height, $ src_w, $src_h);111 imagecopyresampled($dst_im, $src_im, 0, 0, 0,0, $zip_width, $zip_height, $from_w, $from_h); 105 112 106 113 // ²èÁü½ÐÎÏ … … 115 122 // °µ½ÌÀè²èÁü 116 123 $dst_im = imagecreatetruecolor($zip_width, $zip_height); 117 imagecopyresampled($dst_im, $src_im, 0, 0, 0,0, $zip_width, $zip_height, $ src_w, $src_h);124 imagecopyresampled($dst_im, $src_im, 0, 0, 0,0, $zip_width, $zip_height, $from_w, $from_h); 118 125 119 126 // ²èÁü½ÐÎÏ -
temp/trunk/html/test/kakinaka/resize_image.php
r9184 r9187 10 10 11 11 //sfprintr(pathinfo($file)); 12 $path = $objImage->saveResizeImage($file, 0.5, true);12 $path = $objImage->saveResizeImage($file, 100, 100, true); 13 13 14 14 //sfprintr($path);
Note: See TracChangeset
for help on using the changeset viewer.
