我在使用PHPExcel导出将图像插入xls时遇到问题,而图像显示在html表格中(带有fancybox)
此图片由fieldtype_image上传,而导出为excel时,phpexcel“gambar”列仅显示为文件名xxxx.JPG
我的fieldtype_image代码如下所示。
if(strlen($options['value'])>0)
{
$file = attachments::parse_filename($options['value']);
if(isset($options['is_export']))
{
return $file['name'];
}
else
{
if($file['is_image'])
{
$cfg = new fields_types_cfg($options['field']['configuration']);
$fancybox_css_class = 'fancybox' . time();
$img = '<img class="fieldtype_image field_' . $options['field']['id'] . '" src="' . url_for('items/info&path=' . $options['path'] ,'&action=download_attachment&preview=1&file=' . urlencode(base64_encode($options['value']))) . '">';
echo base64_decode($file[is_image]);
$width = (isset($options['is_listing']) ? (strlen($cfg->get('width_in_listing')) ? $cfg->get('width_in_listing'):250) : (strlen($cfg->get('width')) ? $cfg->get('width') : 250));
$html = '
<div class="fieldtype-image-container" style="width: ' . $width . 'px">' .
link_to($img,url_for('items/info&path=' . $options['path'] ,'&action=preview_attachment_image&file=' . urlencode(base64_encode($options['value']))),array('class'=>$fancybox_css_class)) .
(!isset($options['is_listing']) ? '<div class="fieldtype-image-filename" style="width: ' . $width . 'px">
' . link_to('<i class="fa fa-download"></i> ' . $file['name'],url_for('items/info','path=' . $options['path'] . '&action=download_attachment&file=' . urlencode(base64_encode($options['value'])))) . '
</div>' : '') . '
</div>
';
$html .='
<script>
$(document).ready(function() {
$(".' . $fancybox_css_class . '").fancybox({type: "ajax"});
});
</script>
';
return $html;
}
else
{
return '<img src="' . $file['icon'] . '"> ' . link_to($file['name'],url_for('items/info','path=' . $options['path'] . '&action=download_attachment&file=' . urlencode(base64_encode($options['value']))),array('target'=>'_blank')) . ' <small>(' . $file['size']. ')</small>';
任何帮助将不胜感激,谢谢!