2016-07-12 3 views
0

일부 제품 세부 정보가 포함 된 맞춤형 PDF 파일을 만들고 있습니다. 이미지 인 제품 첨부 파일을 표시하고 싶습니다. 나는 브라우저를 통해 URL을 방문 할 때 나는 잘 표시prestashop 첨부 파일 인라인 표시

header('Content-Disposition: inline; filename="'.utf8_decode($a->file_name).'"'); 

에 부착 컨트롤러를 변경 :

http://domain.nl/nl/index.php?controller=attachment&id_attachment=483 

하지만 내 PDF 템플릿에서 img 태그 내부에이 URL을 사용하여 제공합니다

TCPDF ERROR: [Image] Unable to get image: http://domain.nl/nl/index.php?controller=attachment&id_attachment=483 

누구나이 작업을 수행하는 방법에 대한 아이디어가 있습니까?

+0

당신은 헤더 '와 같은 라인 ('콘텐츠 유형이 있습니까 : 응용 프로그램을/pdf ')'? –

답변

1

AttachmentInlineController.php라는 AttachmentController.php 옆에 새 파일을 만들었습니다. 내용량은 약간 상이하다 : I 후크를 제거

<?php 
class AttachmentInlineControllerCore extends FrontController 
{ 
    public function __construct() 
    { 
     $a = new Attachment(Tools::getValue('id_attachment'), $this->context->language->id); 
     if (!$a->id) { 
      Tools::redirect('index.php'); 
     } 


     if (ob_get_level() && ob_get_length() > 0) { 
      ob_end_clean(); 
     } 

     header('Content-Transfer-Encoding: binary'); 
     header('Content-Type: '.$a->mime); 
     header('Content-Length: '.filesize(_PS_DOWNLOAD_DIR_.$a->file)); 
     header('Content-Disposition: inline; filename="'.utf8_decode($a->file_name).'"'); 
     @set_time_limit(0); 
     readfile(_PS_DOWNLOAD_DIR_.$a->file); 
     exit; 

    } 
}?> 

, 인라인 내용 처리를 변경하고, postProcess()에서 __construct하는 기능을 바꿨다. 이제 사용하는 경우 :

http://domain.nl/nl/index.php?controller=attachmentInline&id_attachment=483

그것은 그 첨부 파일을 인라인으로 표시되며, 이미지 태그 등이 URL을 사용할 수 있습니다

관련 문제