News:

Dear forum visitors, if the support forum is not available, please try again a few minutes later. Thanks!

Main Menu
Support-Forum

Google viewer preview. Need some help!

Started by Makulia, 04.12.2014 14:43:27

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Makulia

Hello!

I want to make Google viewer functional patch to be able to preview certain type of documents. Just for the test I have wrote some code:

I am modifying /components/com_jdownloads/views/download/tmpl/default.php

$imgForDirectView = array('gif', 'png' ,'jpg', 'jpeg', 'JPG');
if(preg_match("/\.(".implode('|', $imgForDirectView).")$/", $this->item->url_download)) {
$previewUrl = "<div style='float:left; clear: both;'><img style='max-width: 400px; height: auto;' src='/jdownloads/".$category_dir.DS.$this->item->url_download."' alt='' /></div>";
} else {
$previewUrl = urlencode($category_dir.DS.$this->item->url_download);
$previewUrl = '<iframe src="http://docs.google.com/viewer?url=http%3A%2F%2Fportal.kadis.org%2Fjdownloads%2F'.$previewUrl.'&embedded=true" width="100%" height="680" style="border: none;"></iframe>';
}
$body = str_replace('{download_preview}', $previewUrl, $body);


Problem is - I couldn't get relative path to Jdownloads folder, because $jlistConfig['files.uploaddir'] is returned absolute path.
Could you please tell me how to get relative path to jdowloads folder?
  •