Download and Alternate File Loading Download and Alternate File Loading
 

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

Main Menu

Download and Alternate File Loading

Started by jjhat1, June 06, 2006, 11:48:27 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jjhat1

This plugin serves two very connected purposes.  First of it provides a download link directly above the filename.  The link can be left clicked on and a save as dialogue box appears because the file is transferred through a PHP script.

This leads me to the scripts next functionality that requires a small mod to make it fully functional.  The plugin explains the modification of adding a single line of code.  This script changes all of the file's URLs so that they load through a PHP script.  Now I have not gotten around to adding the security features that I want but it does help with the web server logs.  The plugin simply loads the pictures using the PID and the version that was requested.  This plugin does sacrifice speed because there are two additional queries for each picture that is displayed.  One to lookup the PID and one to look up the file path with the first being part of the page and the second being part of each image.

The modification that goes along with this plugin is as follows:

Find The Line:
return $pic_row['url'];

Place This Line of Code Immediately Before It:
$pic_row = CPGPluginAPI::filter('picture_url',$pic_row);

Be aware that without the modification no error message will be given and the pictures will simply not load through the script.

I hope this helps.  It is a straight forward script and includes some comments about the code.

I do know that there are other similar scripts but I have not seen one yet in the form of a plugin.  The plugin feature allows for very easy installation (besides the fact there is one very small mod).  In my personal opinion this plugin hook would be one that would be very convient in the next version of Coppermine, but I am not a developer. ;)

Additionally, this plugin may not work on versions of Coppermine that have been modified but the placement of the hook ensures that all files will be loaded through the script, with the exception of those that are file type specific.

Version 1.1: Added security that used MD5 to prevent someone from just changing the PID in the URL to access the next picture.
Version 1.2: Fixed an error with the download link caused by the MD5 security.
Version 1.3: Extensive rewrite that changed the way the plugin determines the PID for each image.  Optimized some code that determines which file to load through the script.

Paver

When I tested this plugin, the pid GET variable was not set in the URL created by this plugin to download the file - i.e. index.php?file=download/picture&pid=&method=dl.  I haven't looked to see why.

Also, I wonder why you don't use the 'file_data' plugin hook in themes.inc.php.  Yes, someone might remove this plugin hook by accident when modifying theme_html_picture(), but most likely they will not.  I used this plugin hook for "Full-Size Photos Access Control" to remove the full-size photo link.  Yes, with this hook, you'll have to modify $cpicdata['html'] instead of the URL itself, but this allows it to work without the mod.  There might be confounding details to this suggestion as I haven't tried it myself.

We are considering new plugin hooks for 1.5 and if you find that your added plugin hook is vital, please say so and we will consider it.

jjhat1

#2
I did spend about two hours working on using both the hooks for the thumbnails, intermediate pictures, and full resolution pictures but still I did not manage to convert all of the links.  I do know using those would in fact prevent a query by already having the PID but there were just random instances where it was incontinent.

First, the slide show feature never seemed to change with any of the hooks and the only way was to use the modification which is truly all encompassing.

Additionally, it became very confusing when I was dealing with intermediate files that were not pictures.  For example, they should display their appropriate file type image but I only seemed to break the link even if I set it to ignore these files.

Lastly, movies seem to be dealt with in a special way that just makes it too difficult to get it to point to the given path.

I may hunt down that code that I wrote and post it here as well but the biggest nail in the coffin for me was the slide show not modifying the URL at all.

On a side note, I planned on adding security to my script by having the MD5 version of the path included in the URL.  This would prevent people from just cycling through the pictures to view the entire gallery without regard to weather they are in a hidden album.  Pretty much, I WANT the pid in the URL but it just gives me the creeps that a person with out much effort could access every picture through a single script.

EDIT: I did manage to get a version that used MD5 to perfent someone from just changing the PID.  In the URL is the file path in MD5 that can not be used to locate the file but can still be authenticated before the picture is sent to the user.

will

I have tried this plugin, 2 problems when I tried:

1. With the edited code in function.inc.php it removes all the thumbs, normal & full size pics.

2. Without the edited code in functions.inc.php the picture doesn't download when you click download original file.

Any help ;D

jjhat1

This is somewhat of a work in progress.  ;D I will look into the problem.  The mod to the functions is to create the hook for the plugin to function.  This is not dependent on any way for the download link so that is fishy.  It might have something to do with the way I load the file through the PHP script.  It is not fully compatable if you use a non default albums folder.  I will work on this. 

What version of Coppermine are you using? 

I think I did my testing on a slightly older version but I am upgrading today.

Thanks

will

Well I have a modded version with Stramm's Mod Pack and I am using 1.4.6 ;D

jjhat1

I did find two bugs in the code.  I will update my first post to include my latest version.  I had a typo and a missing line of code that was causing the download link to choke.

will

#7
The download works now but I still get no thumbs, normal & full pics with the editing to functions.inc.php ???

And is there a way of taking out Download: Download Original File and replacing it with an image ;D

Paver

Threads like this one on the plugin contributions board are meant to just announce the contribution and let the contributor add updates and so on.  Bug reports have generally been allowed as well since they deal directly with the contribution as it is.

Feature requests or support using the contribution (non-bug-report) should go on the parent board: cpg1.4 plugins, with reference to this thread.

This is the rule on all contributions boards on this forum.  It's related to the rule: "one issue per thread".

This keeps the contribution announcement thread clean and easy to read for someone first coming to check out the plugin.  It also keeps support issues in separate threads, so they can be discussed, worked out, and marked "solved".

I know in my plugin threads I didn't obey this rule at first, but I strongly recommend following this rule from now on.

dolph

Running:
Coppermine 1.4.9
Download and Alternate File Loading 1.3

This plugin must be uninstalled temporarily in order to edit picture/movie details/info.
With it installed I get a Forbidden File Extension...without it I don't.

dolph

Also, clicking 'Download Original File' works instantly with images but with video sometimes it takes forever for the download dialog box to pop up.

I'm noticing that with large videos (~250MB) it doesn't work?
Does the entire file have to be downloaded before it will work?

I think I'd rather just have it link directly to the file in it's directory.

NetWhiz

The "Last Additions" thumbnails and intermediate pics are not able to be displayed with the edit to the functions.inc.php. When I disable the manual edit to that file, the "Last Additions" thumbnails and intermediate pictures work. If I click on the image through its respective album directly, then the thumbnails and intermediate files show correctly. Anyone else seen this issue?

LnQ

have anyone got this plugin to work with 1.4.9...tryed it but got the same ting no trumbs and normail_* when I modified the function??

donnoman

#13
I've put together a simpler plugin that uses Jared's picture.php and doesn't require any mods.

It only adds a link to the intermediate image page to download the full size picture.  It doesn't do the rest of what THIS thread's plugin does and is not meant as a direct replacement.

You can get the download link off of the CPG-contrib support board for CPGPicdownload.

To avoid confusion of these plugins please limit your posts in this thread to jjhat1's plugin.

To talk about CPGPicdownload, which only is about adding a link on the intermediate image page, please take your post over to the cpg-contrib boards.

http://cpg-contrib.org/board/index.php?board=29.0

Hein Traag

Can this plugin be edited to only allow registered users a download link of the fullsize picture ?

Cheers!
Hein

jjhat1

This plugin was designed to be very comprehensive.  I have not been able to develop this because of a change in priorities, but I have another reason to keep developing this plugin so there may be updates in the not to near future.

Go_on

wow! this is just wat i needed  ;D

so cool! thx for making this! :D

Hein Traag

I went ahead and installed the plugin to see what effect it would have on my CPG.
Turns out i too have the flaw where it does not display any picture anymore but instead only
displays the alt text to click on to see the intermediate or fullsize image.

I do however think this plugin has potential so i'll be watching this thread. Keep up the good work!

Cheers!
Hein

will

Quote from: donnoman on November 04, 2006, 07:29:51 AM
I've put together a simpler plugin that uses Jared's picture.php and doesn't require any mods.

It only adds a link to the intermediate image page to download the full size picture.  It doesn't do the rest of what THIS thread's plugin does and is not meant as a direct replacement.

You can get the download link off of the CPG-contrib support board for CPGPicdownload.

To avoid confusion of these plugins please limit your posts in this thread to jjhat1's plugin.

To talk about CPGPicdownload, which only is about adding a link on the intermediate image page, please take your post over to the cpg-contrib boards.

http://cpg-contrib.org/board/index.php?board=29.0

Is there anyway of adding this download link to the file information block, thanks

akhlan

Hi,

where do you put the 3 files codebase.php, configuration.php and picture.php and I don't find "return $pic_row['url']; " in my functions.inc.php file :-(

I used Copermine 1.4.12 and ChaoticSoul theme

Tks
Akhlan