ÇØÇÇCGI ÀÔ´Ï´Ù.
php ÇÁ·Î±×·¡¸Ó·Î ÀüÇâÁß ¶¡~ php ÀÚü ±â´ÉÀÎ ½æ³×ÀÏÀ» »ç¿ëÇÏ°Ô µÇ¸é
gif,jpg,png ¸ðµÎ ÈÁúÀÌ »ó´çÈ÷ ¶³¾îÁö´Â°É ¾Ë°ÔµÇ¾úÁö¿ä.
¾Æ·¡ ÁÖ¼Ò Âü°í.
http://forum.happycgi.com/board_detail.cgi?db=gold_tip&thread=5007
À§ ÁÖ¼Ò¿¡ ±×¸²À» º¸¸é »ó´çÈ÷ ±×¸²ÀÌ Èñ¹ÌÇϰųª »ö»óÀÌ º¯ÁúµÈ°É º¼¼ö ÀÖ½À´Ï´Ù.
¿ì¼± À߸øµÈ ½æ³×ÀÏÀ» ¸¸µå´Â ¹æ¹ýÀÔ´Ï´Ù. ¸Ûµê~
[ÇÁ·Î±×·¥ÄÚµå]<?php //À̹ÌÁö »çÀÌÁ ±¸Çؼ 100Çȼ¿À» ±âÁØÀ¸·Î ÆÛ¼¾Æ®¸¦ ±¸ÇÑ´Ù. // 100 Çȼ¿Àº ½æ³×ÀÏ °¡·ÎÀ̹ÌÁö°¡ µÇ°í // ¼¼·Î´Â ¿øº»ºñÀ²¿¡ ¸Â°Ô ±¸ÇÑ´Ù. $gi_joon = "100"; $imagehw = GetImageSize("test.jpg"); $imagewidth = $imagehw[0]; $imageheight = $imagehw[1]; $new_height = $imageheight * $gi_joon / $imagewidth ; $new_height=ceil($new_height); $new_width = $gi_joon;
//php ±âº» ÇÔ¼ö¸¦ »ç¿ëÇؼ ½æ³×ÀÏÀ» ¸¸µç´Ù. $src = ImageCreateFromJPEG("test.jpg"); $thumb = ImageCreate($new_height,$new_width); ImageCopyResized($thumb,$src,0,0,0,0,$new_width,$new_height,ImageSX($src),ImageSY($src)); ImageJPEG($thumb,"thumb/test.jpg"); // thumb ¶ó´Â Æú´õ¿¡ test.jpg ¶ó´Â ½æ³×ÀÏÀ» ¸¸µç´Ù. ImageDestroy($thumb); ?> |
Çغ¸½Ã¸é ¾Æ½Ã°ÚÁö¸¸
»ó´çÈ÷ Ä÷¸®Æ¼°¡ ¶³¾îÁö´Â ½æ³×ÀÏÀÌ ¸¸µé¾îÁý´Ï´Ù.
http://www.php.net ¿¡ º¸¸é
ImageJPEG($thumb,"thumb/test.jpg");
¶ó´Â ¿É¼Ç¿¡
ImageJPEG($thumb,"thumb/test.jpg",100);
°ú °°Àº ¹æ½ÄÀ¸·Î Ä÷¸®Æ¼¸¦ Á¶ÀýÇÒ¼ö ÀÖ´Ù°í µÇ¾îÀÖÁö¸¸
½Ç»ó ÅëÇÏÁö ¾Ê½À´Ï´Ù. (php ¹öÁ¯À̳ª GD ¶óÀ̺귯¸®¿¡ µû¶ó¼ ´Ù¸§)
¿Ã¹Ù¸¥ Äڵ带 º¾´Ï´Ù.
[ÇÁ·Î±×·¥ÄÚµå]<?php
//À̹ÌÁö »çÀÌÁ ±¸Çؼ 100Çȼ¿À» ±âÁØÀ¸·Î ÆÛ¼¾Æ®¸¦ ±¸ÇÑ´Ù. // 100 Çȼ¿Àº ½æ³×ÀÏ °¡·ÎÀ̹ÌÁö°¡ µÇ°í // ¼¼·Î´Â ¿øº»ºñÀ²¿¡ ¸Â°Ô ±¸ÇÑ´Ù. $gi_joon = "100"; $imagehw = GetImageSize("test.jpg"); $imagewidth = $imagehw[0]; $imageheight = $imagehw[1];
$new_height = $imageheight * $gi_joon / $imagewidth ;
$new_height=ceil($new_height); $new_width = $gi_joon;
$src = ImageCreateFromJPEG("test.jpg"); $thumb = ImageCreate($new_width,$new_height);
$thumb = imagecreatetruecolor($new_width,$new_height); imagecopyresampled($thumb,$src,0,0,0,0,$new_width,$new_height,imagesx($src),imagesy($src)); ImageJPEG($thumb,"thumb/test.jpg"); ImageDestroy($thumb); ?> |
ÁÁÀº ÇÏ·çµÇ¼¼¿ä.