External Images Links / Use "remote" storage servers - Page 2 External Images Links / Use "remote" storage servers - Page 2
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

External Images Links / Use "remote" storage servers

Started by flux, October 10, 2005, 01:32:46 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

digimic

the pictures are still retrivied on the server?or is it like Phpwebgallery?
can we let all the pictures on the remote server ( thumbnail,normal,big) ?

flux

woops, seems like i've left my additional defines to 1

define('REMOTE_PIC_IFRAME',1);
define('REMOTE_PIC_MAXW',1);

it shouldn't make any difference anyway if you're using intermediate pictures or if you haven't added some remote pictures with my beta4 batch add tool (with pages URL data of course)..

iframes are only visible on popups when you use intermediate pictures AND when the remote picture has a page URL (see doc above)
in any other case the system will continue to use the remote picture URL directly and/or intermediate pictures..


And i forgot to mention that the beta4 version was of course backward compatible with beta3 and of course with regular CPG use, ie "local" pictures..

.flux

flux

@digimic

don't know about Phpwebgallery but my CPG hack still works the same way as it was designed in the beginning

thumbs & intermediate pics are stored locally (you can disable intermediate pics if you want)

the fullsize picture is stored on the remote server, fetched by the batch add tool to create thumbs/intermediate ones and then removed locally.. then whenever the fullsize pic has to be displayed in the gallery the remote picture URL will be used instead of the non existing local fullsize picture..


Making a 100% remote gallery wouldn't be so much trouble as far as displaying picture in CPG can be but the management would definitely be something harder to do something i'm not planning on doing..

.flux



Rc2000

I haven't tried this yet (new to Coppermine), but it sounds like just the thing for one of my galleries. I have several domains I can store files on, so I'll be using my own bandwidth.
Now to find time to do this. ;)

Rc

flux

i haven't mentionned it in my latest 1.4.x version but it works with the current 1.4.3 sources

srijit

flux... thanks for this mod. This is the one that convinced me to try coppermine.... coppermine + joomla integration will come later.
but i am a bit confused. i want to use the remote URL and not the image link. also i already have the thumbnail files which i can rename to the proper convention.
Quote from: flux's instructionsYou will also have to set the default "define('REMOTE_PIC_IFRAME',0);" to "define('REMOTE_PIC_IFRAME',1);" to enable iframes.

Then you can build your remote picture list as follows :
/path/to/album
http://www.freepichost.com/random/path/to/picture_name.jpg \ http://www.freepic.host/page.php?picture=picture_name.jpg

where ( in which file? ) do i have to set define('REMOTE_PIC_IFRAME',0); to 1 ?? is this necessary if i dont plan on using intermediate images?

also can u tell me which database table is being modified by your hack, when i add remote files? this is because then i can directly add the values to the database.... and then upload the thumbnails with the proper names using FTP, to the proper directories. I then wont have to download the remote linked files ( more than 6000 and abt 2 Gb+ ) to my server and waste my and the file hostings bandwidth. i already have abt 50mb's worth of thumbnails that i can rename. i also have the remote URL.

can u please help me with it? thanks in advance :D

srijit

also when i tried to change the settings in config i get this error
Template error
Failed to find block 'log_ecards'(#(<!-- BEGIN log_ecards -->)(.*?)(<!-- END log_ecards -->)#s) in :

                <div align="center">
                <table cellpadding="0" cellspacing="1">
                        <tr>
<!-- BEGIN admin_approval -->
                                <td class="admin_menu" id="admin_menu_anim"><a href="editpics.php?mode=upload_approval" title="{UPL_APP_TITLE}">{UPL_APP_LNK}</a></td>
<!-- END admin_approval -->
                                <td class="admin_menu"><a href="admin.php" title="{ADMIN_TITLE}">{ADMIN_LNK}</a></td>
                                <td class="admin_menu"><a href="catmgr.php" title="{CATEGORIES_TITLE}">{CATEGORIES_LNK}</a></td>
                                <td class="admin_menu"><a href="albmgr.php{CATL}" title="{ALBUMS_TITLE}">{ALBUMS_LNK}</a></td>
                                <td class="admin_menu"><a href="groupmgr.php" title="{GROUPS_TITLE}">{GROUPS_LNK}</a></td>
                                <td class="admin_menu"><a href="usermgr.php" title="{USERS_TITLE}">{USERS_LNK}</a></td>
                                <td class="admin_menu"><a href="banning.php" title="{BAN_TITLE}">{BAN_LNK}</a></td>
                                <td class="admin_menu"><a href="reviewcom.php" title="{COMMENTS_TITLE}">{COMMENTS_LNK}</a></td>

                                <td class="admin_menu"><a href="picmgr.php" title="{PICTURES_TITLE}">{PICTURES_LNK}</a></td>
                                <td class="admin_menu"><a href="searchnew.php" title="{SEARCHNEW_TITLE}">{SEARCHNEW_LNK}</a></td>
                                <td class="admin_menu"><a href="util.php" title="{UTIL_TITLE}">{UTIL_LNK}</a></td>
                                <td class="admin_menu"><a href="profile.php?op=edit_profile" title="{MY_PROF_TITLE}">{MY_PROF_LNK}</a></td>
<!-- BEGIN documentation -->
                                <td class="admin_menu"><a href="{DOCUMENTATION_HREF}" title="{DOCUMENTATION_TITLE}" target="cpg_documentation">{DOCUMENTATION_LNK}</a></td>
<!-- END documentation -->
                        </tr>
                </table>
                </div>


i just replaced the include/themes.inc.php with the one in your pack.... is this what is causing the error?

TEST site is http://cutewalls.com/joomla/gallery

thanks again

srijit

i uploaded my includes and all themes.. then CPG told me that it had to reinstall.... it seems that some database fields were missing.....
now i tried again but using 2nd method.... ie: i added the code in the theme_functions.txt to the classic >> theme.php
i tried again to upload files with the files.php, but here too i am getting an error
Quote from: CPG MessageCritical error
There was an error while processing a database query
Nothing else.... and my gallery is like it this http://cutewalls.com/joomla/gallery
only ONE file is being added although the albums are added OK.
i thought at first problem is with the folder permissions... so i tried again ( with permissions as 777 ), but still only one file is being added, but that too the thumbnail is not being displayed....
am attaching the file that i use to upload

any help is appreciated :D

flux

Quote from: srijit on January 04, 2006, 03:16:52 PM
flux... thanks for this mod. This is the one that convinced me to try coppermine.... coppermine + joomla integration will come later.
but i am a bit confused. i want to use the remote URL and not the image link. also i already have the thumbnail files which i can rename to the proper convention.

well, i probably don't use very specific words but the thing works as follows :

in my first version i was using a single Remote URL which was the direct url to the remote picture and i called that "Remote URL" and it  is stored in the user data field 4, that remote URL is necessary for my hack to work but not to display the picture if you use "Remote Page URLs" thru iframes.
The direct remote picture url aka "Remote URL" is required because it is the very data used to make sure a remote picture is not inserted twice.. And it is also required when you need to access the picture directly of course..

Quote from: srijit on January 04, 2006, 03:16:52 PM
where ( in which file? ) do i have to set define('REMOTE_PIC_IFRAME',0); to 1 ?? is this necessary if i dont plan on using intermediate images?

My two additional Defines() are located where you hack your theme, meaning thru ONE of the two ways i have described to hack your theme, that's where you should modify them but i think i left them both enabled (1) in my release so it should already be set to 1..

Quote from: srijit on January 04, 2006, 03:16:52 PM
also can u tell me which database table is being modified by your hack, when i add remote files? this is because then i can directly add the values to the database.... and then upload the thumbnails with the proper names using FTP, to the proper directories. I then wont have to download the remote linked files ( more than 6000 and abt 2 Gb+ ) to my server and waste my and the file hostings bandwidth. i already have abt 50mb's worth of thumbnails that i can rename. i also have the remote URL.

well my hack does not modify any original CPG tables, it only uses the available data fields (user1 thru user4) in the cpg_pictures table

user4 = Remote URL = direct remote link to the picture (http://www.example.com/path/image.jpg)
user3 = Remote page URL = remote link to the picture page (http://www.example.com/display.php?image=/path/image.jpg)

user2 and user1 can be used to insert any data you'd like thru my batch add tool and using my list file convention
Remote URL \ Remote Page URL \ user2 data \ user1 data


Concerning your errors, are you using CPG version 1.4.3 ?

Overwritting include/thems.inc.php shouldn't make any problems if it does then put back the original file and try to hack the theme file of the theme you'll use in themes/xxx/theme.php
you can't overwrite that one you must do copy paste


Concerning your remaining setup i can't really tell if my hack has any thing to do with your errors, if you follow my install documentation it should be okay..

Remember that you should add remote pictures only with my batch add tool, if you insert them manually in the database and forget some required data (obviously user4 and user3 data) then it won't work..


srijit

hey thanks..... i am now testing the hack with Remote URL ( direct Link to the file ) in this case should the filed3 value "Remote Page URL" be filled? if it is filled and i dont give it in the text file ( attached in the previous post ) will it cause an error?
also why is the thumbnail not being generated? and why is there an error after adding the first new file in the list?
i am using CPG 1.4.3 which i downloaded yesterday

URL is http://cutewalls.com/joomla/gallery

thanks for your help :)

srijit

hmmm.... so if i add everything correctly in the cpg_pictures table ( including remote URL and remote page URL ) then if i upload the thumb files and the dummy files via FTP to the correct locations, it should work right?

also what happens if i dont have the direct URL but only the remote page URL? will that work alone? can the user4 field be left blank?

server is being moved now... so i cant test it out :(

flux

humm so

user4 config name = "Remote URL"
user4 data = Direct Pirture URL = http://www.esample.com/path/picture.jpg

Must be given whichever display mode you use..

Now user3 config name and data (remote page url) are optional because it is only used for iframes mode.

user2 & user1 data and config names are completely optional and are NOT requiered for anything to work..

If you want the thumbnails to be generated you MUST use my batch add tool, and to use my batch add tool you MUST build a list file according to my documentation.

I would strongly suggest you try to insert a single remote picture using my batch add tool and see how it works when you turn on and off the iframe define, only if you use remote page url of course, and it will also give you a proper example how a picture row has to be inserted if you want to manually insert files and place them on your server..

All of this is rather simple and i really believe i explained the most important things you need to take care of in order to get my hack to work but maybe trying to do too many new things at the same time gets you confused..

srijit

oh dear.... it not workinf, even though i followed instructions.... well no matter. i will try later :D

sectioni

#33
Terrific mod - just what I was looking for.

One question.  It doesn't seem to respect the thumbnails for video files.  When doing a standard batch add of movies, I can have mymovie.wmv and thumb_mymovie.jpg and it will make that jpg the thumb for the video file.  Is it possible for the remote files upload to set the thumb like the standard upload?  Certainly not a big deal, but it would be nice.

Also, can't use the 'download to my computer' link when viewing the video remotely.  It just saves a 0kb file.

Thanks.

[Edited about a 1/2 hour later - oops]

Nevermind about the thumbnail.  I found that if you just put the thumb_.jpg files in the album directory, it works just fine.

flux

yeah sorry i have absolutely never made any tests with video files on cpg and so never tested it with my remote files mod..

I'm not sure how cpg handles thumbnails for video files actually..

I made some tests on php5 with a codec modules to extract/create thumbnails out of video files works nice, i guess in some future cpg could have an feature like that to manage video thumbnails as it does with picture files..

sectioni

Not sure if this is the correct way to do it, but I modified the download.php file to accomodate the remote file links.  In download.php, I had to make a few changes to download remote files:

Changed:

Quote
        $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"';

to

Quote
        $sql = 'select '.
                'p.filepath,'.
                'p.filesize,'.
                'p.filename,'.
                'p.user4,'.
                $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"';

Then changed:

Quotereadfile($CONFIG['fullpath'].$file['filepath'].$file['filename']);

to

Quote
if ($CONFIG['user_field4_name'] == "Remote URL" && $file['user4'] != "" ) {
        readfile($file['user4']);
} else {
        readfile($CONFIG['fullpath'].$file['filepath'].$file['filename']);
}

and that now allows me to download files from this remote link mod.  I'm completely new to php, so please let me know if I did anything wrong.

Thanks again for this great mod!



flux

it would have to be checked out but what you've done probably makes the gallery server download the remote file thru the readfile function call..

In my opinion this is a waste of bandwidth and could cause other nasty side effects..
The general idea would be to skip local processing of file downloads when you're accessing remote file, a simple link to the remote file on the remote server should be enough to give access to that file..

I'm just guessing here but i imagine that download.php script's purpose is to collect statistics of downloads and stuff like that and maybe manage some sort download security or access restrictions..

In my opinion that should only be applied to local files, files on the gallery server itself, not to remote files which should be left with a full free access to anyone..

If you want or need to keep a counter running for those downloads, another way to do that woud be to let download.php do its thing and then force it to redirect to the remote file location, triggering the download of that remote file on the client end..
I think that wouldbe more appropriate although it would probably require more script tweaking and debugging..

But you should seriously consider my explanation above concerning your modification and the bandwidth usage problem..

donpeyote

#37
i installed beta4 with, changed the Remote URL and replaced themes.inc.php e slideshow just like it shows in the Install...everything fine until i started to add files..

this is my file.txt i go get in files.php
"
/banhada2006/
http://pdam.no.sapo.pt/banhada2006/tomar-banhada-2006_001.jpg
"
after that , i hit continue and i get this page:
"
File Uploaded : file.txt
File Size : 78
Album Created:banhada2006
Adding to list: http://pdam.no.sapo.pt/banhada2006/tomar-banhada-2006_001.jpg
1 Remote Pictures Links Found
0 Remote Pictures in the database
After filtering 1 NEW Remote Pictures will be added.
structure created, 1 files to add.
"
everything ok, i hit Continue and i get an error:
"
Error ! The Remote File could not be accessed: http://pdam.no.sapo.pt/banhada2006/tomar-banhada-2006_001.jpg
Back to the main form : Back"

i can check the URL, here is working...maybe im missing something...i havent edit files.php

i also changed include/functions.inc.php - Line 905 ## as told

flux

that error simply indicates that the function used to "open" the file failed to open it.
that function (fopen) is initially designed to open local files but recent php versions extended the scope of this file access function to URL under the only condition that the parameter "allow_url_fopen" is enabled in your php.ini

you should be able to make sure you can actually access http:// files by trying to add the picture to your gallery thru the regular admin tools and by using that same URL..
If you can't add files to your gallery using URLs then you won't be able to use my batch add tool..

Of course the problem could have other origins, like for example the server running your gallery has troubles accessing files from those urls (cf my test above)..

.flux

donpeyote

#39
when adding with admin tools i get this error :

URI/URL Uploads:
File Name/URL   Error Message
1. http://pdam.no.sapo.pt/banhada2006/tomar-banhada-2006_001.jpg   Could not open URI.


i even tried with a google.com image, one from microsoft, even frm home page of my hosting..so most probably theres no problem with that specific image/site but with 'fopen' right?

im running on a free webserver

Apache version     1.3.34 (Unix)
PHP version    4.4.1
MySQL version    4.1.19

is there anyway to enable allow_url_fopen or to check it status or i must contact my hosting?

but ill try to get help elsewhere since now this is a different problem, still if you can help ... :)