사이트 내 전체검색
wordpress
워드프레스 php.ini 에서 allow_url_fopen 사용이 금지된경우 (false 지정) getimagesize() 오류 처리 php 함수중 getimagesize() 함수의 경우 http:// 로 시작되는 섬네일을 받을수 없다. 그러므로 해당 오류가 나
프리이미지
https://cmd.kr/wp/36 URL이 복사되었습니다.

본문

워드프레스  php.ini 에서 allow_url_fopen 사용이 금지된경우 (false 지정) getimagesize() 오류 처리

php 함수중 getimagesize() 함수의 경우 http:// 로 시작되는 섬네일을 받을수 없다.

그러므로 해당 오류가 나는 루틴에서 파일명을 http:// 가 제외된 full path 파일명으로 만들어야 한다.

 

 

Warning: getimagesize(): http:// wrapper is disabled in the server configuration by allow_url_fopen=0 in .... /wp-content/themes/business-elite/inc/front/WDWT_front_functions.php on line 197 Warning: getimagesize(http://~~~/uploads/2016/06/images.jpg): failed to open stream: no suitable wrapper could be found in ... /wp-content/themes/business-elite/inc/front/WDWT_front_functions.php on line 197 

 

 

변경전 소스

 

list($w, $h) = getimagesize($thumb_url);

 

 

변경후 소스

 

if (strstr($thumb_url,'://'.$_SERVER['HTTP_HOST'])) {

$tmp_arr=explode('/',$thumb_url,3);

if ($tmp_arr[2]) {

$tmp_img=str_replace($_SERVER['HTTP_HOST'],$_SERVER['DOCUMENT_ROOT'],$tmp_arr[2]);

}

if (is_file($tmp_img)) $thumb_url=$tmp_img;

}

list($w, $h) = getimagesize($thumb_url);

 

 

 

댓글목록

등록된 댓글이 없습니다.

wordpress
43 (1/1P)

Search

Copyright © Cmd 명령어 3.144.113.197