php 이미지 필터 씌운 파일 html에 띄우기 채택완료
스크립트 코드가 있는 php에서 이미지 필터를 씌운 (php.php)것을 불러와 html img로 띄우고싶은데 오류가 발생합니다. 어떻게 수정해야하는건가요?
조언 부탁드립니다.
참고할만한 예시를 보여주는 사이트가 있다면 링크 부탁드립니다.
스크립트 코드입니다.
</strong></p>
<p><div id="timg2">
</div>
<script type="text/javascript"></p>
<p>
(a = function(){
var v = $('#timg').var;
$.ajax({
url: 'php.php',
type: 'post',
data: v,
contentType: false,
processData: false,
success: function(response){
$('#timg2').append('<img src="'+response+'" width="500">');
}
});
}); //왼쪽 이미지 파일 업로드 버튼 클릭시 실행 끝</p>
<p> a();
</script></p>
<p><strong>
이미지에 필터를 적용하는 php 코드입니다. (php.php)
</strong></p>
<p><?php
// Load the png image
$response = imagecreatefrompng(
'<a href="https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png');" target="_blank" rel="noopener noreferrer">https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png');</a></p>
<p>// Colorize the image
imagefilter($response, IMG_FILTER_COLORIZE, 140, 140, 140, 10);</p>
<p>// Show the output
header('Content-type: image/png');
imagepng($response);</p>
<p>die("{\"response\":\"$response\"}");
?></p>
<p><strong>
답변 1개
답변을 작성하려면 로그인이 필요합니다.
로그인
이런식으로 깨지는 글자가 백줄 넘게 반복되다가
Fatal error: Uncaught Error: Object of class GdImage could not be converted to string in F:\xampp\htdocs\php.php:18 Stack trace: #0 {main} thrown in F:\xampp\htdocs\php.php on line 18
" width="500">
이 에러가 뜹니다.