4images Forum & Community

4images Issues / Ausgaben => Installation, Update & Configuration => Topic started by: Neil_L12 on May 27, 2003, 09:58:33 PM

Title: Changing the media directory off site?
Post by: Neil_L12 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.
Title: Changing the media directory off site?
Post by: Chris 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.
Title: Changing the media directory off site?
Post by: Neil_L12 on May 27, 2003, 11:38:41 PM
ok thanks

it was a nice idea though
Title: Changing the media directory off site?
Post by: SLL on May 27, 2003, 11:50:17 PM
you can try remote mysql usage, if your host would allow this
Title: Changing the media directory off site?
Post by: Chris on May 28, 2003, 04:36:36 AM
Good idea! That's probably the easiest and best solution.  :wink:
Title: Changing the media directory off site?
Post by: Neil_L12 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?
Title: Changing the media directory off site?
Post by: SLL on May 28, 2003, 12:18:14 PM
i think so, though i've never tried it myself...
Title: Changing the media directory off site?
Post by: Neil_L12 on May 28, 2003, 12:27:01 PM
I give it a try, thanks
Title: Changing the media directory off site?
Post by: Chris on May 28, 2003, 04:04:18 PM
Check www.mysql.com for further info and consult with your web hosting provider.
Title: Changing the media directory off site?
Post by: Gre 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:
Title: Re: Changing the media directory off site?
Post by: hyde101 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.
Title: Re: Changing the media directory off site?
Post by: V@no 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.
Title: Re: Changing the media directory off site?
Post by: hyde101 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.
Title: Re: Changing the media directory off site?
Post by: relu 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.
Title: Re: Changing the media directory off site?
Post by: relu 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!