나는 특정 크기의 이미지를 가지고 있는데, 크기를 축소하려고합니다.이미지를 브라우저에 표시하기 전에 크기를 재조정하는 방법은 무엇입니까?
내가 조정에 저장하지 않으, 난 내가 a를 WideImage
라이브러리와 같은 모양과 imagecopyresampled
경우를했다 한
브라우저에서 그들에게 크기를 이미지로드를 때마다 다시 할 내가 WideImage::load($_GET['img'])->resize(500, 300)->output('jpg', 90);
을 사용하고 나는이 이미지와 실제 이미지가 아닌 소스 코드를 얻는다.
은 또한이 방법을
public function resizeImage($originalImage,$toWidth,$toHeight)
{
list($width, $height) = getimagesize($originalImage);
$xscale=$width/$toWidth;
$yscale=$height/$toHeight;
if ($yscale>$xscale){
$new_width = round($width * (1/$yscale));
$new_height = round($height * (1/$yscale));
}
else {
$new_width = round($width * (1/$xscale));
$new_height = round($height * (1/$xscale));
}
$imageResized = imagecreatetruecolor($new_width, $new_height);
$imageTmp = imagecreatefromjpeg ($originalImage);
imagecopyresampled($imageResized, $imageTmp, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
return $imageResized;
}
을 세례반 및 내가에 화상을 전달하고 결과를 에코 있을지 resource(192) of type (gd)
아닌 화상을 얻는다.
또한 어떤 이미지 경로가이 방법에 통과 확실하지 메신저의 http://.....jpg
또는 /var/www/images/....jpg
수있는 사람 그늘이에 대한 몇 가지 빛? 이 이미지를 해석하는 난 정말이 과정이
난 당신이 반환 PHP 파일에 이미지의'src'를 설정해야 @Patrioticcow 페이지가 – Patrioticcow
나누기 그렇게 할 경우 이미지 만. – jeroen
그래서 HTML 페이지에서 이미지를 출력 하시겠습니까? 만약 '' 태그가 – Musa