Phoca Download Plugin - Icons

Phoca plugins - support for all Phoca plugins except Phoca Gallery plugins
korvax
Phoca Newbie
Phoca Newbie
Posts: 4
Joined: 07 Mar 2008, 09:08

Phoca Download Plugin - Icons

Post by korvax »

Hey there,

i just tested the Phoca Download Plugin and it works great. The only thing i'm missing is, that when you link a file directly the icon of the file is always the same (harddrive with arrow).
Is it possible to show the icon provided (add file dialog) next to it and not just a standard icon? That would be really great. The reason is, that i display a language flag next to the files, if i link through the download plugin, you can't see in what language that file content is.

I would really appreciate it.
Thanks in advance and for the great download-component.
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48402
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phoca Download Plugin - Icons

Post by Jan »

Hi, now you can change the size of the icon, I will take a look at it, maybe I will find some behaviour how to paste there custom image.

Jan
If you find Phoca extensions useful, please support the project
dax702
Phoca Enthusiast
Phoca Enthusiast
Posts: 85
Joined: 10 May 2008, 21:11

Re: Phoca Download Plugin - Icons

Post by dax702 »

I too am interested in this idea. With the download plugin, I want to insert a PDF file, and would like to show a PDF icon to the user. I suppose I could just overwrite the /plugins/content/phocadownload/images/icon-download-64.png file, but what if I need to show some other type of file besides PDF? There should be a way to change the icon in the plugin But very nice plugin overall for sure! :twisted:
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48402
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phoca Download Plugin - Icons

Post by Jan »

Hi, yes, it is in feature request list. Not the only limitation factor is the time :-(
If you find Phoca extensions useful, please support the project
xcore
Phoca Newbie
Phoca Newbie
Posts: 3
Joined: 03 Feb 2011, 19:26

Re: Phoca Download Plugin - Icons

Post by xcore »

Just wanted to express my "vote" for this feature. Icon based on filetype seems essential to me.

Thanks!
simon.howell
Phoca Newbie
Phoca Newbie
Posts: 1
Joined: 30 Nov 2011, 11:31

Re: Phoca Download Plugin - Icons

Post by simon.howell »

This has also got my vote with one minor tweak - the ability to have no icon sometimes. For example sometimes I need to include a link to a file in the middle of a sentence. I don't want an icon to appear in this instance but I may want the icons in a list of links.

Could this be added as an attribute e.g. "icon=pdf | xls | doc | img | mov | mp3 | no"?
Demonike
Phoca Member
Phoca Member
Posts: 11
Joined: 10 Jun 2009, 23:54

Re: Phoca Download Plugin - Icons

Post by Demonike »

The Add File form has a field for custom file icon, it only seems not to be implemented in the plugin (the plugin only shows generic icon). Being able to override in the code attributes that you insert into the article seems to be the way to go if you need this file linked without its icon once in a while, but an a general option might be useful as well, if this is the way you need your files linked most of the time and only exceptionally need an icon for a file. Via general option this behavior could be swapped and then overridden for specific places when needed.

A good idea, I vote "for".
As of Phoca Download Plugin v 2.1.6 this functionality is still missing.
Demonike
Phoca Member
Phoca Member
Posts: 11
Joined: 10 Jun 2009, 23:54

Re: Phoca Download Plugin - Icons

Post by Demonike »

korvax wrote:Is it possible to show the icon provided (add file dialog) next to it and not just a standard icon? That would be really great. The reason is, that i display a language flag next to the files, if i link through the download plugin, you can't see in what language that file content is.
This is an ancient post, but it is relatively simple to achieve this with only CSS overrides.
Since you call out this plugin via text code, you can wrap the code into a proprietary DIV, for example:

Code: Select all

<div class="download-icon-pdf">
   {phocadownload view=filelist|id=2}
</div>
Then, in your template folder, there should be a CSS folder and in it you can create if not existing already, "custom.css". You will store all your template overrides in that document. The override goes like this:

Code: Select all

.download-icon-pdf .phocadownloadfilelist {
background:none; 
border:none;
}
.download-icon-pdf .phocadownloadfilelist32 {
border-bottom: 1px solid #EEE;
background: transparent url(../images/icon-pdf-32.png) 5px center no-repeat;
}
What happens here, is that we effectively isolate the .phocadownloadfilelist32 class from other instances and only achieve this look where we specifically want this (permits the use of other icons elsewhere on the page, but not in the same set, unfortunately, - we will keep waiting for the proper custom icon support in Phoca Download Plugin).

.phocadownloadfilelist regulates the area around the file-block and
.phocadownloadfilelist32 regulates the individual file container block and the 32 depends on the icon size chosen from the general options.

Then place an image file with the content and dimensions (32x32 in this case) of your liking to your "images" directory withing your template directory.

Code: Select all

../your-template/images/icon-pdf-32.png
Demonike
Phoca Member
Phoca Member
Posts: 11
Joined: 10 Jun 2009, 23:54

Re: Phoca Download Plugin - Icons

Post by Demonike »

I figured it out.
Jan, this will take 30min max for you to implement properly :)

Code: Select all

plugins/content/phocadonwload/phocadownload.php
Go to FILELIST section (around line 230).
Into the SELECT query add somewhere "a.image_filename,"
Goto line 272, modify to the following:

Code: Select all

} else {
$link = PhocaDownloadHelperRoute::getFileRoute($item->id,$item->catid,$item->alias,$item->catalias, 0, 'download');
$icon = $item->image_filename;
}
$output .= '<div class="phocadownloadfilelist'.(int)$iSize.'" style="background:url(../images/phocadownload/'.$icon.') 5px center no-repeat;"><a href="'. JRoute::_($link).'" '.$targetOutput.'>'. $textOutput.'</a></div>';
}
This might not be the most elegant way (hardcoding CSS), but it gets results. Since the icon is displayed as a background image for a div, the other way would be to include PHP code in CSS and THAT is a mess, I have seen it :wink:
User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 48402
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Phoca Download Plugin - Icons

Post by Jan »

Hi, thank you for the guide.

Jan
If you find Phoca extensions useful, please support the project
Post Reply