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;
}
게시판 목록
토크
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 3000 |
solsu1
|
10년 전 | 1461 | |
| 2999 |
|
10년 전 | 2657 | |
| 2998 |
Qstudio
|
9년 전 | 1076 | |
| 2997 | 10년 전 | 2527 | ||
| 2996 |
|
10년 전 | 1817 | |
| 2995 | 10년 전 | 1195 | ||
| 2994 |
|
10년 전 | 1636 | |
| 2993 |
|
10년 전 | 1476 | |
| 2992 |
준짱789
|
10년 전 | 1707 | |
| 2991 | 10년 전 | 2989 | ||
| 2990 |
개발짜증나
|
10년 전 | 1137 | |
| 2989 | 10년 전 | 1393 | ||
| 2988 | 10년 전 | 3069 | ||
| 2987 |
해븐리키스
|
10년 전 | 3045 | |
| 2986 | 10년 전 | 3297 | ||
| 2985 | 10년 전 | 2960 | ||
| 2984 |
|
10년 전 | 1937 | |
| 2983 | 10년 전 | 1848 | ||
| 2982 |
프로그램은어려워
|
10년 전 | 1514 | |
| 2981 |
잘살아보자
|
10년 전 | 1113 | |
| 2980 |
잘살아보자
|
10년 전 | 1087 | |
| 2979 |
잘살아보자
|
10년 전 | 1785 | |
| 2978 | 10년 전 | 2074 | ||
| 2977 | 10년 전 | 3401 | ||
| 2976 |
|
10년 전 | 2529 | |
| 2975 |
|
10년 전 | 1648 | |
| 2974 | 10년 전 | 1590 | ||
| 2973 | 10년 전 | 1918 | ||
| 2972 |
패션리스트
|
10년 전 | 3147 | |
| 2971 |
패션리스트
|
10년 전 | 2860 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기