News:

Support for jDownloads 3 has been ended
Since 17 August 2023 Joomla.org has discontinued support for Joomla 3.x. Therefore, we will no longer offer official support for our Joomla 3 jDownloads version 3.9.x from January 2024.
Please update your website to the latest Joomla version (Joomla 4 or Joomla 5) as soon as possible. Afterwards, please update jDownloads to the latest published version. The longer you delay, the more difficult the upgrade process for your website is likely to be.

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?
  •