아래의 소스는 jpg,gif,png 등을 서버에 올리는 소스의 일부인데요.
실제 jpg,gif,png 등의 포맷이 잘 올라갑니다.
근데 저 소스를 보면, imagejpeg 이것이 있는데..
이건 php.net의 정의에 의하면 "imagejpeg() creates a JPEG file from the given image . "
이렇게 되어 있거든요.. 그러면 jpeg만 받아서 올려야 하는데.. 왜 다른 포맷까지 잘 되는걸까요?
$dst = imagecreatetruecolor($img_limit_width, $height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_limit_width, $height, $size[0], $size[1]);
imagejpeg($dst, $data_path.'/'.$row2[bf_file], $img_quality);
chmod($data_path.'/'.$row2[bf_file], 0606);
참고로, 다른 확장자는 따로 있네요..
imagepng() - Output a PNG image to either the browser or a file
imagegif() - Output image to browser or file
imagewbmp() - Output image to browser or file
실제 jpg,gif,png 등의 포맷이 잘 올라갑니다.
근데 저 소스를 보면, imagejpeg 이것이 있는데..
이건 php.net의 정의에 의하면 "imagejpeg() creates a JPEG file from the given image . "
이렇게 되어 있거든요.. 그러면 jpeg만 받아서 올려야 하는데.. 왜 다른 포맷까지 잘 되는걸까요?
$dst = imagecreatetruecolor($img_limit_width, $height);
imagecopyresampled($dst, $src, 0, 0, 0, 0, $img_limit_width, $height, $size[0], $size[1]);
imagejpeg($dst, $data_path.'/'.$row2[bf_file], $img_quality);
chmod($data_path.'/'.$row2[bf_file], 0606);
참고로, 다른 확장자는 따로 있네요..
imagepng() - Output a PNG image to either the browser or a file
imagegif() - Output image to browser or file
imagewbmp() - Output image to browser or file
댓글을 작성하시려면 로그인이 필요합니다.
댓글 2개
이미지 포맷을 그대로 유지하시려면, 이미지에 따라 다른 함수를 사용하셔야겠지요.
지금 상태로는 어떤 이미지를 넣던지 jpg 이미지로 변환 시키는 상태입니다.
감사합니다.