PHP 버전이 낮아 imagerotate() 함수가 없을때 대신 사용하는 함수
--------------------------------------
그누보드4에서 모바일 파일첨부시 세로사진이 옆으로 누워버리길래..
찾다가 기존에 쓰는 방법인 imagerotate()함수가 php버전이 낮으면 작동이 안되고 찾을수 없다고 나온다..
그래서 열심히 구글링 후 다른 방법을 찾았기에.. 여기에 남김..
중복이면 죄송.
--------------------------------------
function rotateImage($img, $rotation) {
$width = imagesx($img);
$height = imagesy($img);
switch($rotation) {
case 90: $newimg= @imagecreatetruecolor($height , $width );break;
case 180: $newimg= @imagecreatetruecolor($width , $height );break;
case 270: $newimg= @imagecreatetruecolor($height , $width );break;
case 0: return $img;break;
case 360: return $img;break;
}
if($newimg) {
for($i = 0;$i < $width ; $i++) {
for($j = 0;$j < $height ; $j++) {
$reference = imagecolorat($img,$i,$j);
switch($rotation) {
case 90: if(!@imagesetpixel($newimg, $j, $width - $i, $reference )){return false;}break;
case 180: if(!@imagesetpixel($newimg, $width - $i, ($height - 1) - $j, $reference )){return false;}break;
case 270: if(!@imagesetpixel($newimg, ($height - 1) - $j, $i, $reference )){return false;}break;
}
}
} return $newimg;
}
return false;
}
게시글 목록
| 번호 | 제목 |
|---|---|
| 18122 | |
| 18118 | |
| 18105 | |
| 18104 | |
| 18103 | |
| 18100 | |
| 18088 | |
| 18085 | |
| 18082 | |
| 18077 | |
| 18074 | |
| 18073 | |
| 18069 | |
| 18067 | |
| 18063 | |
| 18062 | |
| 18061 | |
| 18060 | |
| 18059 |
웹서버
서버 동시접속자 설정 변경하기
|
| 18058 | |
| 18057 | |
| 18055 | |
| 18054 | |
| 18053 |
MySQL
테이블 복사 쿼리
|
| 18052 |
PHP
현재 접속중인 사용자 나타내기
|
| 18051 |
MySQL
mysql select 후 update 하기
|
| 18050 | |
| 18049 |
PHP
한글문자열 자르는 법 입니다.
|
| 18048 | |
| 18047 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기