Displays a link 'download movie' below a movie in intermediate view. Left click on it opens the movie in the standard app (eg. Media Player), right click -> save as is of course possible too
Version v1.1 downloads on left click
Here's the solution to a problem I had on my galleries. Plugin "CPGPicDownload" doesn't work with large files and, of course, videos (due to restrictions from my server host I suppose).
With Movie Download all works OK! Thanks Stramm!
Just a quick question, how to let it appear also for other file format (ie. PDF, DOC, etc etc)? I understand the line on codebase.php
if ($mime_content['content']=='movie') {
$download_link_data = '<a href="index.php?file=movie_download/down&link=' .$fullsize_url.'">Download</a>';
is the one to modify, but having zero knowledge of PHP, it's hard for me to find it out....... :(
I've commented following code
if ($mime_content['content']=='movie')
to obtain the "download" link for all file format. Is there a way to have it shown for all format except images? Anyone can just point me to the right direction? ;-)
if ($mime_content['content']!='image')
It was so easy then... sometimes solutions are just beneath the nose... thanks!
Here we go then, I've modified codebase.php and made it working for movies and documents. Here's the new codebase.php for whoever might be interested
<?php
/**************************************************
CPG Movie Download Link Plugin for Coppermine Photo Gallery
*************************************************
Copyright (c) 2006 Thomas Lange <stramm@gmx.net>
*************************************************
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
*************************************************
Coppermine version: 1.4.10
CPG Movie Download Link Plugin version: 1.1
$Revision: 1.0 $
$Author: stramm $
***************************************************/
if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');
$thisplugin->add_filter('file_data','download_link_add_data');
function download_link_add_data($pic_data){
global $CONFIG;
$fullsize_url = get_pic_url($pic_data);
$mime_content = cpg_get_type($pic_data['filename']);
if ($mime_content['content']=='movie') {
$download_link_data = ' <a class="admin_menu" href="index.php?file=movie_download/down&link=' .$fullsize_url.'" title="Download">DOWNLOAD VIDEO</a>';
}
if ($mime_content['content']=='document') {
$download_link_data = ' <a class="admin_menu" href="index.php?file=movie_download/down&link=' .$fullsize_url.'" title="Download">DOWNLOAD DOCUMENT</a>';
}
$pic_data['html'] = $pic_data['html'].$download_link_data;
return $pic_data;
}
?>
PS. I've also modified the download button style, to better fit with the gallery ;-)
I just wanted to say thanks for posting this. It has been a real life-saver. I know the thread is old, but kudos.
Is there a possibility to enable this plugin only to registered users?
Try adding this to the code and also add a } at the end of the file before the ?>
<?php
$result = mysql_query("SELECT user_name FROM {$CONFIG['TABLE_USERS']} WHERE user_group = Registered AND uid = $uid");
if {
mysql_num_rows($result) == 0;
echo 'Registered user function';
} else {
?>
This may work, not really sure i used this code (http://uk.php.net/mysql-num-rows) you may want to look into it a bit more.
or just add
if(!USER_ID) return $pic_data;
after
global $CONFIG;
@just_some_guy: you have contributed some code snippets in various threads that suggest to run a native mysql query against the database even though you're on a coppermine-driven page. Your efforts to contribute are welcome in the first place, but your advice is just not correct, so it's our moderation task to clarify. Your code is wrong and not recommended. Don't run additional queries if you can avoid this, and don't add another potential point of failure by running native mysql commands. Take a look into coppermine's core code: there are functions that for database call abstraction. In your case, take a look at the functions cpg_db_connect, cpg_db_query, cpg_db_error, cpg_db_fetch_rowset etc.
In this case, Stramm's suggestions are the correct ones. They are much easier to apply, they don't cause extra load and don't add potential issues with queries being run improperly.
Ok, thanks GauGau i will look into the coppermine code.
Thanks,
It works fine for me, thanks Stramm.
And thanks to just_some_guy too, at least your code has taught something to me!!!
Quote from: Stramm on March 06, 2007, 08:00:38 PM
Displays a link 'download movie' below a movie in intermediate view. Left click on it opens the movie in the standard app (eg. Media Player), right click -> save as is of course possible too
Version v1.1 downloads on left click
This appears to be a real lifesaver. I have just downloaded it and notice that there are no docs for installing same. Are there any available?
Thanks,
Lyman
RTFM (http://coppermine-gallery.net/demo/cpg14x/docs/index.htm#plugin_manager) - there are instructions how to install plugins in the documentation that comes with Coppermine. Yet another posting of you that shows you haven't read the docs before posting. ::)
awesome upgrade! :) thank you thank you thank you!
Is there a way to add an image like a blinking gif that says "download here" so that the retards who claim they can't figure out how to download the videos can see it easier? I know it sounds ridiculous but I swear I get emails every week with people asking how to download the videos!
Thank you!
(I'm sorry to ask what is probably a stupid question but I don't know PHP at all!)
xoxo
Mariah
in codebase.php replace 'Download movie' with your desired img tag (all html)
its not working for me :(
here's the code Im pasting
$download_link_data = '<a href="index.php?file=movie_download/down&link=' .$fullsize_url.'<img src="plugins/movie_download/coppermine-download-button.gif">';
whats wrong with it?
thankl u!
That's not how this works - this is a plugin, you just install it using the plugin manager (refer to the documentation how to install plugins), that's all. You don't edit code.
I have the plugin working already, I just dont understand how to change it from a link to an image. I'll look at the documentation again but I've already installed the plugin.
thank u again! :)
change
$download_link_data = ' <a class="admin_menu" href="index.php?file=movie_download/down&link=' .$fullsize_url.'" title="Download">DOWNLOAD VIDEO</a>';
to:
$download_link_data = ' <a class="admin_menu" href="index.php?file=movie_download/down&link=' .$fullsize_url.'" title="Download"><img src="plugins/movie_download/coppermine-download-button.gif"></a>';
sweet! it works! :)
thank u so much!
xoxo
Mariah
I see how to add the "download ..." link for Video and Document but what is a GIF, JPG, PPT or PPTX (MS Office 2007) files and MP3's considered?
This plugin is insecure; there is no check on the file that is being requested for download. Anyone using this should disable it.
Hi Stramm, thanks for this plugin.
is there some method to check the session of users in the file down.php?
If the users are not registered then to redirect them to the page of login and thus to avoid hotlinking.
Thanks.
you shouldn't use this plugin as it is unsecure as Nibbler already pointed out.
I've another version here but not yet prepared it for public use.
It wouldn't be a problem to check for the user being logged in. But that wouldn't protect from hotlinking at all.
Thanks for your input, Stramm
Excuse me, but i dont know programming in PHP. I was reading about use session_start(), if(isset($_SESSION["variable_session"])){ and I dont understand nothing about this ;D
Nibbler pointed out that this plugin is insecure to direct download... it means should I remove the plugin? :o
What is the diferent between direct download:
mydomain.com/gallery/index.php?file=file_download/down&link=albums/uploads/mymusic.mp3
and
mydomain.com/gallery/albums/uploads/mymusic.mp3 <<< (Save as)
With this: index.php?file=file_download/down&link= in htaccess I need rewrite rule for files .php and redirect in hotlinking. But this does not interest to me to do.
I like this plugin, help me please ::)
Quote from: Niecher on November 10, 2009, 03:17:37 PM
Nibbler pointed out that this plugin is insecure to direct download... it means should I remove the plugin? :o
Yes, that's what he said:
Quote from: Nibbler on September 02, 2008, 02:31:18 PM
This plugin is insecure; there is no check on the file that is being requested for download. Anyone using this should disable it.
If you're not a programmer that's fine, but you should take our word then that this plugin is insecure. Malevolent visitors of your site could use the plugin to obtain configuration files on your server that would give them admin access to your server. Anything could happen if you don't heed the advice to get rid of this plugin. That's what we consider "insecure". We're not ready to explain why exactly that is the case if you can't understand what the code does anyway.
Thanks, Joachim Müller
I take you word and I remove the plugin.
:'(
Quote from: Niecher on November 10, 2009, 04:38:23 PM
Thanks, Joachim Müller
I take you word and I remove the plugin.
:'(
Ohhhh, I just understand why is insecure !!!
Then I remove file down.php and
index.php?file=file_download/down&link= but I use the rest of plugin for save file as