1
이미지가 저장된 이진 파일이 있는데이 이미지를 가져 오지만 검정색 이미지 만 표시합니다. 내 코드 또는 이진 파일에 문제가있을 수 있습니다. 이 코드 바이너리 파일의 PHP 디스플레이 PNG 이미지
<?php
function LoadPNG ($imgname) {
$im = @imagecreatefrompng ($imgname);
if (!$im) {
$im= imagecreate (150, 30);
$bgc = imagecolorallocate ($im, 255, 255, 255);
$tc= imagecolorallocate ($im, 0, 0, 0);
imagefilledrectangle ($im, 0, 0, 150, 30, $bgc);
imagestring ($im, 1, 5, 5, "Error loading $imgname", $tc);
}
return $im;
}
header('Content-Type: image/png');
$img = LoadPNG('452');
imagepng($img);
imagedestroy($img);
?>
내가 파일을로드 할 수 없습니다 I 오류가
파일 : testams.serveriai.lt.lazdynas.serveriai.lt/452 스크립트 : testams.serveriai.lt.lazdynas.serveriai.lt/crypt.php
이것은 당신이 http://stackoverflow.com/questions/2070603/php-recreate-and-display-an-image-from-binary-data – Pooshonk
나는 "로드 오류 452"을 볼 수 있습니다 도움이 될 수 있습니다 Safari의 스크립트 페이지에있는 이미지. 특정 브라우저에서만 작동합니까? –
@MattGibson 모든 브라우저에서 사용 가능합니다. – user2250371