Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1] 2 3   Go Down

Author Topic: Download video hack for v. 1.4.2  (Read 39790 times)

0 Members and 1 Guest are viewing this topic.

tripslip38

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Download video hack for v. 1.4.2
« on: December 01, 2005, 10:48:11 pm »

I found the thread for the code change in the 1.3 boards about making a link to let users download video files instead of streaming them in the embedded player. In displayimage.php 1.4, I can't even find any of the same variables to hack as was described in the 1.3 hack.

Old hack: http://forum.coppermine-gallery.net/index.php?topic=9367.0

Suggestions?

Zane
« Last Edit: December 20, 2005, 08:28:56 am by GauGau »
Logged

Nibbler

  • Guest
Re: Download video hack for v. 1.4.2
« Reply #1 on: December 01, 2005, 10:49:36 pm »

That code is part of the theme system now, you can find it in your theme's theme.php or in include/themes.inc.php
Logged

bwschult

  • Coppermine newbie
  • Offline Offline
  • Posts: 17
Re: Download video hack for v. 1.4.2
« Reply #2 on: December 01, 2005, 10:58:08 pm »

tripslip, I would be definitely be interested in that.  As my videos don't play on Mac OS, I'm looking into alternative ways for my users to view videos other than the embedded player.
Logged

tripslip38

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: Download video hack for v. 1.4.2
« Reply #3 on: December 01, 2005, 11:20:31 pm »

Ok, I searched around, and with Nibbler's redirect to the new location of the code, I came up with this solution, which worked beautifully:

Step 1) Create download.php

Copy/paste this code into a file called download.php, and put it in the Coppermine application root:

Code: [Select]
<?php
//
// hack to allow downloading of pictures and movies
// see http://forum.coppermine-gallery.net/index.php?topic=6464.0
//
define('IN_COPPERMINE',true);
define('UPLOAD_PHP',true);
define('DOWNLOAD_PHP',true);

require(
'include/init.inc.php');

function 
download()
{
        global 
$CONFIG$lang_upload_php$FORBIDDEN_SET;

        
$pid = (int) $_GET['pid'];

        
$sql 'select '.
                
'p.filepath,'.
                
'p.filesize,'.
                
'p.filename,'.
                
$CONFIG['TABLE_ALBUMS'].'.visibility, '.
                
'p.aid as aid '.
                
'from '.$CONFIG['TABLE_PICTURES'].' as p LEFT JOIN '.$CONFIG['TABLE_ALBUMS'].
                
' ON (p.aid = ' $CONFIG['TABLE_ALBUMS'].'.aid ) '.
                
' where pid='.$pid.' and approved="YES"';

        if (!empty(
$FORBIDDEN_SET)) {
                
$sql .= ' and '.$FORBIDDEN_SET;
        }

        
$result cpg_db_query($sql);

        
// No data returned; Display an error page
        
if (mysql_num_rows($result)==0) {
                
mysql_free_result($result);
                
cpg_die(CRITICAL_ERROR,$lang_upload_php['unknown']);
        }

        
$file mysql_fetch_assoc($result);
        
mysql_free_result($result);

        
// Empty output buffer
        
while(ob_get_level()>0) {
                
ob_end_clean();
        }

        
// Send binary information to the browser
        
header("Content-type: application/octet-stream");
        
header("Content-disposition: attachment; filename=".$file['filename']);
        
header("Content-Length: ".$file['filesize']);
        
header("Pragma: no-cache");
        
header("Expires: 0");
        
readfile($CONFIG['fullpath'].$file['filepath'].$file['filename']);
}

download();
?>

Step 2) Change theme.php

Open the theme.php for the theme your're using.

FIND:
Code: [Select]
        $pic_html  = '<object id="'.$player['id'].'" '.$player['classid'].$player['codebase'].$player['mime'].$image_size['whole'].'>';
        $pic_html .= "<param name=\"autostart\" value=\"$autostart\" /><param name=\"src\" value=\"". $picture_url . "\" />";
        $pic_html .= '<embed '.$image_size['whole'].' src="'. $picture_url . '" autostart="'.$autostart.'" '.$player['mime'].'></embed>';
        $pic_html .= "</object><br />\n";

REPLACE WITH:
Code: [Select]
        $pic_html  = '<object id="'.$player['id'].'" '.$player['classid'].$player['codebase'].$player['mime'].$image_size['whole'].'>';
        $pic_html .= "<param name=\"autostart\" value=\"$autostart\" /><param name=\"src\" value=\"". $picture_url . "\" />";
        $pic_html .= '<embed '.$image_size['whole'].' src="'. $picture_url . '" autostart="'.$autostart.'" '.$player['mime'].'></embed>';
        $pic_html .= "</object><br />\n";
$pic_html .= "<p><a href=\"download.php?pid={$CURRENT_PIC_DATA['pid']}\">Click here to download</a></p>";


That should do you. In addition to the media file opening in an embedded player now, a link to download will display.


Zane
« Last Edit: December 02, 2005, 03:11:39 am by tripslip38 »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Download video hack for v. 1.4.2
« Reply #4 on: December 02, 2005, 12:10:45 am »

Open the theme.php for the theme your're using, or theme.inc.php
don't!
Logged

mini1400

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 34
    • Minis & Megaliths
Re: Download video hack for v. 1.4.2
« Reply #5 on: December 02, 2005, 12:17:00 pm »

Open the theme.php for the theme your're using.

FIND:
Code: [Select]
        $pic_html  = '<object id="'.$player['id'].'" '.$player['classid'].$player['codebase'].$player['mime'].$image_size['whole'].'>';
        $pic_html .= "<param name=\"autostart\" value=\"$autostart\" /><param name=\"src\" value=\"". $picture_url . "\" />";
        $pic_html .= '<embed '.$image_size['whole'].' src="'. $picture_url . '" autostart="'.$autostart.'" '.$player['mime'].'></embed>';
        $pic_html .= "</object><br />\n";

REPLACE WITH:
Code: [Select]
        $pic_html  = '<object id="'.$player['id'].'" '.$player['classid'].$player['codebase'].$player['mime'].$image_size['whole'].'>';
        $pic_html .= "<param name=\"autostart\" value=\"$autostart\" /><param name=\"src\" value=\"". $picture_url . "\" />";
        $pic_html .= '<embed '.$image_size['whole'].' src="'. $picture_url . '" autostart="'.$autostart.'" '.$player['mime'].'></embed>';
        $pic_html .= "</object><br />\n";
$pic_html .= "<p><a href=\"download.php?pid={$CURRENT_PIC_DATA['pid']}\">Click here to download</a></p>";


Hmm, can't find that code in the mac_os_x theme..... any ideas?

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Download video hack for v. 1.4.2
« Reply #6 on: December 02, 2005, 01:38:52 pm »

Hmm, can't find that code in the mac_os_x theme..... any ideas?

Some themes don't use all the overrides.  Go to the "sample" theme and copy the relevant section from its theme.php into your theme.php.  If you haven't done so already, I'd copy the default Mac_OS_X theme into a new folder so you can modify at will and still have the default (for upgrades and overall sanity).
Logged

mini1400

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 34
    • Minis & Megaliths
Re: Download video hack for v. 1.4.2
« Reply #7 on: December 19, 2005, 05:03:28 pm »

hotvins

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 20
    • Just Vids
Re: Download video hack for v. 1.4.2
« Reply #8 on: January 15, 2006, 05:15:06 pm »

I am getting following error messege !!

Quote
Fatal error: Call to undefined function: db_query() in /home/vwad/public_html/masala/download.php on line 32
Logged
Thanks to all the Creators & Coders of Coppermine Photo Gallery

hotvins

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 20
    • Just Vids
Video Download Hack Problem
« Reply #9 on: January 15, 2006, 05:59:54 pm »

I have searched very hard but cannot find solution for this

I have successfully changed the files themes.inc.php and have uploaded download.php file as per the hack instructions but I am getting just a blank page or sometimes a file gets downloaded with a 1 kb size instead of the original video file size of 346 kb.

I am confident and have checked that the video file is there and is of 346 kn in my albums/uploads folder

My gallery link is

http://hotvins.300megs.com/masala/

The file I am talking about is located here

http://hotvins.300megs.com/masala/displayimage.php?album=lastup&cat=0&pos=0

Help needed

thanks in advance

hotvins
Logged
Thanks to all the Creators & Coders of Coppermine Photo Gallery

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Download video hack for v. 1.4.2
« Reply #10 on: January 15, 2006, 08:34:21 pm »

hotvins:  Check your modifications again.  db_query is a deprecated function from version 1.3.  The function in 1.4 is cpg_db_query.  You could merely fix your current error, but I would check this thread again against your code to make sure you are using everywhere the 1.4 code.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Video Download Hack Problem
« Reply #11 on: January 15, 2006, 10:38:03 pm »

Don't edit themes.inc.php!
Post what mod you're refering to.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Video Download Hack Problem
« Reply #12 on: January 15, 2006, 10:42:56 pm »

I just found out what posting you refered to, as you cross posted there as well. Merging this new thread you started with the other one you refered to. Don't double post nor cross post, it just makes supporter's life harder.
Logged

hotvins

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 20
    • Just Vids
Re: Download video hack for v. 1.4.2
« Reply #13 on: January 16, 2006, 03:50:58 am »

sorry abt posting thing !!

this script was installed by my server using fantastico

I know the procedure to upload the script and setting it up.

Should I download latest version and upload it to my server in other folder ?

I am not able to understand what to check.

Please Help

Thanks

Hotvins
Logged
Thanks to all the Creators & Coders of Coppermine Photo Gallery

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Download video hack for v. 1.4.2
« Reply #14 on: January 16, 2006, 07:33:25 am »

Fantastico is buggy and not recommended by the coppermine dev team. Upgrade to cpg1.4.3 using the package we provide.
Logged

hotvins

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 20
    • Just Vids
Re: Download video hack for v. 1.4.2
« Reply #15 on: January 16, 2006, 08:55:53 am »

Ok GauGau Bro.

Thanks a lot I shall do that and see what happens but please keep an eye on this thread for atleast two more days from your busy schedule since I may encounter some problems and will be posting in this thread only

Cheers & Good Wishes
Hotvins
Logged
Thanks to all the Creators & Coders of Coppermine Photo Gallery

hotvins

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 20
    • Just Vids
Re: Download video hack for v. 1.4.2
« Reply #16 on: January 16, 2006, 05:31:33 pm »

I am not getting this thing right

Please tell me again in step by step method
Logged
Thanks to all the Creators & Coders of Coppermine Photo Gallery

hotvins

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 20
    • Just Vids
Re: Download video hack for v. 1.4.2
« Reply #17 on: January 16, 2006, 05:44:41 pm »

BTW I have installed 1.4.3 but not yet able to get download possible

http://hotvins.300megs.com/vids/
Logged
Thanks to all the Creators & Coders of Coppermine Photo Gallery

hotvins

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 20
    • Just Vids
Re: Download video hack for v. 1.4.2
« Reply #18 on: January 17, 2006, 02:16:17 am »

Should I edit the theme.php ?
Logged
Thanks to all the Creators & Coders of Coppermine Photo Gallery

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Download video hack for v. 1.4.2
« Reply #19 on: January 17, 2006, 02:32:56 am »

hotvins: Posting multiple times is not going to help to get a response faster.  The only post in the last 4 you posted that is useful is the one where you said you installed 1.4.3 and gave a link to your site.  The other 3 were really not necessary and can annoy people who want to help.

I looked at your site and here's my suggestion.  Take a look at this line again in your theme.php:
Code: [Select]
$pic_html .= "<p><a href=\"download.php?pid={$CURRENT_PIC_DATA['pid']}\">Click here to download</a></p>";I believe that in the line before this one, you are are missing the ending quotation mark.  Check your lines against the ones in the post above.
Logged
Pages: [1] 2 3   Go Up
 

Page created in 0.03 seconds with 20 queries.