에디터 이미지 암호화

에디터 이미지 암호화

QA

에디터 이미지 암호화

본문

기존


<?php } else {
$thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height'], false, true);
          if($thumb['src']) {
            $img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" style="width:80px; height:50px;">';
           } else {
           $img_content = '<div class="no_image" style="margin-left:5px; width:80px; height:50px; line-height:50px; text-align:center; border:1px solid #00495f">no image</div>';
            }
    echo $img_content;
 }
 ?>
 
                            

 

이와같이 처리했는데 왜 엑박이죠 -_-;; 

 

수정


<?php } else {
$thumb = get_list_thumbnail($board['bo_table'], $list[$i]['wr_id'], $board['bo_gallery_width'], $board['bo_gallery_height'], false, true);
          if($thumb['src']) {
            $img_content = '<img src="'.$thumb['src'].'" alt="'.$thumb['alt'].'" style="width:80px; height:50px;">';
           } else {
           $img_content = '<div class="no_image" style="margin-left:5px; width:80px; height:50px; line-height:50px; text-align:center; border:1px solid #00495f">no image</div>';
            }
    //echo $img_content;

$img_src = $thumb; 
$imgbinary = fread(fopen($img_src, "r"), filesize($img_src)); 
$img_str = base64_encode($imgbinary); 
echo '<img src="data:img/jpg;base64,'.$img_str.'" />';

 }
 ?>
 

 

에디터 이미지는 암호화 처리못하나요?

이 질문에 댓글 쓰기 :

답변 2

<?
 function getImageDataFromUrl($url)
{
    $urlParts = pathinfo($url);
    $extension = $urlParts['extension'];
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    $response = curl_exec($ch);
    curl_close($ch);
    $base64 = 'data:image/' . $extension . ';base64,' . base64_encode($response);
    return $base64;

}
?>
<img src="<?echo getImageDataFromUrl($img_src)?>">

 

curl 이용해서 할수도 있지요. 

당연히 못합니다.

이미지 데이터는 string data가 아닙니다.

base64_encode는 string data 용 함수입니다.

 

그리고 이미지 다운로드 막으실려면 다른 방법을 택하셔야 합니다.

답변을 작성하시기 전에 로그인 해주세요.
전체 49
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT