본문 바로가기
코드 간편모음

이미지 사이즈 구하기 (MySql)

by 찬찬2 2021. 3. 18.

forums.phpfreaks.com/topic/57253-getimagesize-too-slow-why/

 

 

function getimagesize_remote($image_url) {

    $handle = fopen ($image_url, "rb");

    $contents = "";

    if ($handle) {

    do {

        $count += 1;

        $data = fread($handle, 8192);

        if (strlen($data) == 0) {

            break;

       }

    $contents .= $data;

    } while(true);

    } else { return false; }

    fclose ($handle);

 

    $im = ImageCreateFromString($contents);

    if (!$im) { return false; }

    $gis[0] = ImageSX($im);

    $gis[1] = ImageSY($im);

    // array member 3 is used below to keep with current getimagesize standards

    $gis[3] = "width={$gis[0]} height={$gis[1]}";

    ImageDestroy($im);

    return $gis;

}

댓글