jDownloads Support Forum

Older Versions => jDownloads 3.2 (Support ended) => General => Topic started by: Makulia on 04.12.2014 14:43:27

Title: Google viewer preview. Need some help!
Post by: Makulia on 04.12.2014 14:43:27
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?