qdpm(项目经理)无法渲染附加的图像预览

qdpm(项目经理)无法渲染附加的图像预览

问题描述:

The problem is the following, if you purchase the qdpm "extended" addon (the paid version of qdpm) you notice that the attached images is possible to download, but not possible to preview on the "View" button.

The render image shows "image cannot display because contain errors".

Is very annoying that I can't contact with the technical support of this software but it's open source on PHP (Symphony) and I can modify the code.

问题如下,如果你购买了qdpm“extended”插件(qdpm的付费版本),你会注意到 附加的图像可以下载,但无法在“查看”按钮上预览。 p>

渲染图像显示“图像无法显示,因为包含错误 strong>”。 p>

非常烦人,我不能 请联系该软件的技术支持,但它是PHP(Symphony)的开源代码,我可以修改代码。 p> div>

I answer my own question because I achieve to solve the error.

You need to modify this file:

qdpm_root/core/apps/qdPMExtended/modules/attachments/actions/actions.class.php

Search executeView() function and replace this code:

if($size = getimagesize($file_path))
{
  $filename = substr(str_replace(array(' ',','),'_',$attachments->getFile()),7);

  header('Content-Disposition: filename="' . $filename . '"');                          
  header("Content-type: {$size['mime']}");                  
  ob_clean();
  flush();

  readfile($file_path);
}

with this:

if($size = getimagesize($file_path))
{
  $filename = substr(str_replace(array(' ',','),'_',$attachments->getFile()),7);

  header('Content-Disposition: filename="' . $filename . '"');                          
  header("Content-type: {$size['mime']}");     

  readfile($file_path);             
  ob_clean();
  flush();
}

And it works like a charm.