Support Forum Project Downloads FAQ Documentation About Demo Tutorials Blog Plugins
November 21, 2009, 02:56:39 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: cpg1.5.2 beta released
The brand new cpg1.5.x series that comes with a lot of new features finally has reached the release stage: a first public beta release cpg1.5.2 has been released that is mainly aimed at translators, testers and community members that have contributed in the past. The beta release is not meant to be used in a production environment, but only on testbeds and for evaluation purposes. There is currently no support for cpg1.5.x yet!
[more]
   Home   Help Search Board rules Login Register  
Pages: [1] 2   Go Down
  Send this topic  |  Print  
Author Topic: Movie download link  (Read 19730 times)
0 Members and 1 Guest are viewing this topic.
Stramm Topic starter
Dev Team member
****
Gender: Male
Posts: 5622



« on: March 06, 2007, 07: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

* movie_download.zip (1.07 KB - downloaded 1013 times.)
* movie_download_v1.1.zip (1.62 KB - downloaded 1191 times.)
« Last Edit: March 07, 2007, 10:15:35 am by Stramm » Logged

my CPG sandbox: Version 1.4.18 with modpack running my Tentacle theme:
http://stramm.st.funpic.org/
Davide Renda
Dev Team member
****
Gender: Male
France France

Posts: 1319


aka "Lontano"


WWW
« Reply #1 on: March 11, 2007, 09:10:38 am »

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
Code:
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....... Sad
Logged

Davide Renda
Dev Team member
****
Gender: Male
France France

Posts: 1319


aka "Lontano"


WWW
« Reply #2 on: March 25, 2007, 09:01:43 pm »

I've commented following code
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? ;-)
Logged

Stramm Topic starter
Dev Team member
****
Gender: Male
Posts: 5622



« Reply #3 on: March 25, 2007, 09:14:59 pm »

Code:
if ($mime_content['content']!='image')
Logged

my CPG sandbox: Version 1.4.18 with modpack running my Tentacle theme:
http://stramm.st.funpic.org/
Davide Renda
Dev Team member
****
Gender: Male
France France

Posts: 1319


aka "Lontano"


WWW
« Reply #4 on: March 26, 2007, 09:11:45 am »

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

Code:
<?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 ;-)
Logged

radianation
Coppermine regular visitor
**
Gender: Male
Posts: 79



WWW
« Reply #5 on: August 20, 2007, 12:39:40 am »

I just wanted to say thanks for posting this. It has been a real life-saver. I know the thread is old, but kudos.
Logged
Davide Renda
Dev Team member
****
Gender: Male
France France

Posts: 1319


aka "Lontano"


WWW
« Reply #6 on: October 28, 2007, 08:36:34 pm »

Is there a possibility to enable this plugin only to registered users?
Logged

just_some_guy
Supporter
****
United Kingdom United Kingdom

Posts: 539


I am currently on holiday, back in a few weeks. :D


« Reply #7 on: October 28, 2007, 09:02:05 pm »

Try adding this to the code and also add a } at the end of the file before the ?>

Code:
<?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 you may want to look into it a bit more.
Logged

Tambien, Hablo Español      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums
Stramm Topic starter
Dev Team member
****
Gender: Male
Posts: 5622



« Reply #8 on: October 29, 2007, 07:08:51 am »

or just add
Code:
if(!USER_ID) return $pic_data;
after
Code:
global $CONFIG;
Logged

my CPG sandbox: Version 1.4.18 with modpack running my Tentacle theme:
http://stramm.st.funpic.org/
Joachim Müller
Administrator
*****
Gender: Male
Germany Germany

Posts: 45051


aka "GauGau"


WWW
« Reply #9 on: October 29, 2007, 07:20:21 am »

@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.
Logged
just_some_guy
Supporter
****
United Kingdom United Kingdom

Posts: 539


I am currently on holiday, back in a few weeks. :D


« Reply #10 on: October 29, 2007, 05:07:02 pm »

Ok, thanks GauGau i will look into the coppermine code.

Thanks,
Logged

Tambien, Hablo Español      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums
Davide Renda
Dev Team member
****
Gender: Male
France France

Posts: 1319


aka "Lontano"


WWW
« Reply #11 on: October 29, 2007, 06:59:12 pm »

It works fine for me, thanks Stramm.
And thanks to just_some_guy too, at least your code has taught something to me!!!
Logged

LGLDSR
Coppermine regular visitor
**
Posts: 83


« Reply #12 on: November 28, 2007, 12:04:53 am »

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
Logged
Joachim Müller
Administrator
*****
Gender: Male
Germany Germany

Posts: 45051


aka "GauGau"


WWW
« Reply #13 on: November 28, 2007, 07:00:38 am »

RTFM - 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. Roll Eyes
Logged
mariahxxx
Coppermine regular visitor
**
Posts: 56


« Reply #14 on: February 10, 2008, 06:06:02 pm »

awesome upgrade! Smiley 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
Logged
Stramm Topic starter
Dev Team member
****
Gender: Male
Posts: 5622



« Reply #15 on: February 10, 2008, 06:23:21 pm »

in codebase.php replace 'Download movie' with your desired img tag (all html)
Logged

my CPG sandbox: Version 1.4.18 with modpack running my Tentacle theme:
http://stramm.st.funpic.org/
mariahxxx
Coppermine regular visitor
**
Posts: 56


« Reply #16 on: February 17, 2008, 12:42:20 pm »

its not working for me Sad
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!
Logged
Joachim Müller
Administrator
*****
Gender: Male
Germany Germany

Posts: 45051


aka "GauGau"


WWW
« Reply #17 on: February 17, 2008, 01:27:05 pm »

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.
Logged
mariahxxx
Coppermine regular visitor
**
Posts: 56


« Reply #18 on: February 17, 2008, 01:38:42 pm »

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! Smiley
Logged
SaWey
Dev Team member
****
Gender: Male
Belgium Belgium

Posts: 1119



WWW
« Reply #19 on: February 17, 2008, 01:41:09 pm »

change
Code:
$download_link_data = '      <a class="admin_menu" href="index.php?file=movie_download/down&link=' .$fullsize_url.'" title="Download">DOWNLOAD VIDEO</a>';

to:
Code:
$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>';
Logged
Pages: [1] 2   Go Up
  Send this topic  |  Print  
 
Jump to:  

Powered by SMF 1.1.10 | SMF © 2006-2009, Simple Machines LLC
Page created in 0.049 seconds with 18 queries.