저는 Joomla 개발자 및 PHP에 익숙합니다. 그래서 내가 바보 같은 짓을하고 있다면 알려주세요!Joomla 내에서 호출 할 때 이미지가 표시되지 않습니다
사용자가 이름, 날짜 등으로 퀴즈를 완료 한 후에 인쇄 할 인증서를 만들 수 있습니다. 이미지를 표시하고 텍스트를 표시했지만 글꼴을 추가 할 때 아무것도 표시되지 않습니다.
여기 내가 사용 기본 스크립트이고 (작업 배경 이미지 및 글꼴) 작동 :
$image_file = 'images/certificate_page.png';
$my_img = imagecreatefrompng ($image_file);
$font_size_big = 24;
$text_colour = imagecolorallocate($my_img, 0, 0, 0);
$font_file = 'FelipaRegular.ttf';
imagefttext($my_img, $font_size_big, 0, 5, 75, $text_colour, $font_file, "test with font");
imagestring($my_img, 4, 30, 25, "test without font", $text_color);
header("Content-type: image/png");
imagepng($my_img);
imagecolordeallocate($text_color);
imagedestroy($my_img);
내가 줌라 내에서 적용하려고 할 때 문제가 시작합니다.
<img src="<?php echo JURI::root().'index.php?tmpl=certgenerator&quizmod='.$quizmod.'' ?>" />
및 파일 생성기 (certgenerator.php) :
defined('_JEXEC') or die;
require_once("includes/variables_certificate.php");
$image_file = JURI::root().'templates/'.$this->template.'/images/certificate_page.png';
$my_img = imagecreatefrompng ($image_file);
$font_size_big = 24;
$text_color = imagecolorallocate($my_img, 0, 255, 0);
$font_file = 'FelipaRegular.ttf';
imagefttext($my_img, $font_size_big, 0, 55, 75, $text_color, $font_file, "why u no work"); //if commented out image displays but not font obviously, as it's written now it returns a blank page
imagestring($my_img, 4, 30, 25, "works", $text_color); //works but doesn't include font
header("Content-type: image/png");
imagepng($my_img);
imagecolordeallocate($text_color);
imagedestroy($my_img);
참조 :
http://php.net/manual/en/function.imagettftext.php
내가 해봤 imagettftext이 같은 템플릿 내에서 호출 해요 확장자가없는 imagefttext, 위의 링크에서 물건 묶음, 모든 동일한 결과. 어떤 아이디어? 나는 바보 같은 것을 추측하고있다.
올바른 디렉토리에 올바른 권한을 가진 유효한 글꼴 파일이 있습니까? –
두 스크립트 모두 글꼴과 동일한 디렉토리에 있습니다. 그것은 Joomla 내에서 경로 문제가 될 수 있지만. 나는 아무 성공없이 여러 가지 다른 길을 시도했다 - Joomla는 특정 길이나 위치를 요구할 것이다? – Gisto