Author Topic: Changing the media directory off site?  (Read 19872 times)

0 Members and 1 Guest are viewing this topic.

Offline Neil_L12

  • Newbie
  • *
  • Posts: 11
    • View Profile
Changing the media directory off site?
« on: May 27, 2003, 09:58:33 PM »
hello,

firstly I'd like to add that this gallery system is a fantastic tool, I have installed it onto my webspace and integrated it with phpbb, I am using this gallery system to let my friends upload photos from our skiing holidays and for others to download them, the system works very well.

however, I have only got 20Mb of webspace that has a mysql database and I am running out of space, I have a second webspace area that has 50Mb available under a different service provider but it has no mysql database.

if it is possible I would like to move my data/media folder to this new webspace whilst keeping the main bulk of the 4images system on my original server, I have looked in the constants.php file and found line 132:

Code: [Select]
define('MEDIA_DIR', 'data/media');

how would I go about changing this location to an off site media directory, I have tried to just put the location 'http://www.webspace.com/media' in place of the 'data/media' but with no luck.

summary:

I have:
www.webspace.com/user/4images/ = 20Mb space
would like to move and re-reference the media folder to:
www.different_space.com/user/data/media/ = 50Mb space

if anyone has done this, or you can think of a way to do this it would be very helpfull to me.

thanks
Neil.

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Changing the media directory off site?
« Reply #1 on: May 27, 2003, 10:59:50 PM »
You can't do that.  That constant must be set to a directory on a file system known to the web server in use.  You cannot place a URL there.

You're only alternative is to first upload the images to the 50Mb web space, then when you add a new image, place the URL to the uploaded file in the Image>URL field instead of browsing for a file to upload.

Offline Neil_L12

  • Newbie
  • *
  • Posts: 11
    • View Profile
Changing the media directory off site?
« Reply #2 on: May 27, 2003, 11:38:41 PM »
ok thanks

it was a nice idea though

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
Changing the media directory off site?
« Reply #3 on: May 27, 2003, 11:50:17 PM »
you can try remote mysql usage, if your host would allow this

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Changing the media directory off site?
« Reply #4 on: May 28, 2003, 04:36:36 AM »
Good idea! That's probably the easiest and best solution.  :wink:

Offline Neil_L12

  • Newbie
  • *
  • Posts: 11
    • View Profile
Changing the media directory off site?
« Reply #5 on: May 28, 2003, 11:08:01 AM »
yes that sound like an idea, I guess I'd just replace the 'localhost' with the IP of the webspace... is that the way it works?

Offline SLL

  • Hero Member
  • *****
  • Posts: 585
    • View Profile
Changing the media directory off site?
« Reply #6 on: May 28, 2003, 12:18:14 PM »
i think so, though i've never tried it myself...

Offline Neil_L12

  • Newbie
  • *
  • Posts: 11
    • View Profile
Changing the media directory off site?
« Reply #7 on: May 28, 2003, 12:27:01 PM »
I give it a try, thanks

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Changing the media directory off site?
« Reply #8 on: May 28, 2003, 04:04:18 PM »
Check www.mysql.com for further info and consult with your web hosting provider.

Offline Gre

  • Newbie
  • *
  • Posts: 36
    • View Profile
Changing the media directory off site?
« Reply #9 on: June 02, 2003, 09:44:13 PM »
Quote from: SLL
you can try remote mysql usage, if your host would allow this


Anyway, he said that the 50 mb space does not support mysql at all.  :roll:

Offline hyde101

  • Sr. Member
  • ****
  • Posts: 410
  • 34TR.COM (Running 4images)
    • View Profile
    • Nostalgia Istanbul
Re: Changing the media directory off site?
« Reply #10 on: April 13, 2009, 10:37:32 PM »
I have a similar question, (wow this topic is old, but to the point!)
I have two 4images in the same host, just under different directories. Is there anyway to tell 4images to go up one folder and grab media from another folder?

I have
webspace/4images/data/media/
and
webspace/4imagesNEW/data/media/

Is there anyway to get data from a root or parent directory? Something like

define('MEDIA_DIR', '../4imagesNEW/data/media');

I just want to move my data to the new installation while retaining the old one so I can keep working on the original one.

Please Vote for my site: Here

Offline V@no

  • If you don't tell me what to do, I won't tell you where you should go :)
  • Global Moderator
  • 4images Guru
  • *****
  • Posts: 17.849
  • mmm PHP...
    • View Profile
    • 4images MODs Demo
Re: Changing the media directory off site?
« Reply #11 on: April 14, 2009, 02:39:18 AM »
Something like

define('MEDIA_DIR', '../4imagesNEW/data/media');

Theoretically it should work. But keep in mind, 4images doesn't care what it's in media_dir directory unless these files are added into the database.
Your first three "must do" before you ask a question:
Please do not PM me asking for help unless you've been specifically asked to do so. Such PMs will be deleted without answer. (forum rule #6)
Extension for Firefox/Thunderbird: Master Password+    Back/Forward History Tweaks (restartless)    Cookies Manager+    Fit Images (restartless for Thunderbird)

Offline hyde101

  • Sr. Member
  • ****
  • Posts: 410
  • 34TR.COM (Running 4images)
    • View Profile
    • Nostalgia Istanbul
Re: Changing the media directory off site?
« Reply #12 on: April 14, 2009, 05:13:46 AM »
I already edited the config.php to match the previous database (points to same database), yes, it works now. :)
Although it is a good idea to point /templates to the default one because it gets messed up easily.

Please Vote for my site: Here

Offline relu

  • Newbie
  • *
  • Posts: 44
    • View Profile
    • Pulsarmedia
Re: Changing the media directory off site?
« Reply #13 on: June 21, 2009, 11:38:54 PM »
If i have more subdomains on the same server and i want to use just from one place to read images ... DATA folder... is possible? I want to use in different setup the same database and the  same images but i don't want to make another copy  images.

Offline relu

  • Newbie
  • *
  • Posts: 44
    • View Profile
    • Pulsarmedia
Re: Changing the media directory off site?
« Reply #14 on: July 05, 2012, 06:03:25 PM »
    From 3 years i had this in my mind and today i get the solution...  my solution...

i have a dedicated server and 2 galeries with same database.  Now both galeries from diferent domains also is using the same folder gallery... and that is cool for my... i din't get any solution until today.


  In first place you must be shure SymLinks is running on your server!

For that I just added in my http.conf the folowing lines:

<Directory "/home/domain2">
    Options Includes Indexes FollowSymLinks
    AllowOverride All
    Order allow,deny
    Allow from all
</Directory>

For VPS will be:  (not teste myself... my server is dedicate)
Edit the /private/etc/apache2/extra/httpd-vhosts.conf file and add:
<VirtualHost *:80> 
    <Directory /Users/yourUserName/Sites/MyWebSite.com>
        Options +FollowSymlinks +SymLinksIfOwnerMatch
        AllowOverride All
    </Directory>
  DocumentRoot /Users/yourUserName/Sites/MyWebSite
  ServerName MyWebSite.local
</VirtualHost>

Be shure AllowOverride is set to "All" ...otherwise rewrite engine will be ignored.



   Then you must create a SymLink where /data  folder is and rename it for safety the original one. (first time rename folder ex: datax and then make the SymLink (a shortcut pointing the other gallery data folder. You can create the SymLink (shorcut) with SCP for windows or from terminal Mac Osx to run the command:

ln -s /home/domain1/public_html/data /home/domain2/public_html/   (that mean that domain2 will have in public_html where data folder is located, the SymLink "data" witch will point to domain1 data folder.



That's all Folks

I also tested the upload and the image is on both sites with just one upload.

I love this script guys!
« Last Edit: July 05, 2012, 06:27:49 PM by relu »