Author Topic: Using same DB for 2 sites.  (Read 3697 times)

0 Members and 1 Guest are viewing this topic.

Offline twiter

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Using same DB for 2 sites.
« on: July 14, 2010, 03:53:55 PM »
I have copied my 4images gallery to another domain which is hostet on same server.
There is only one problem,
It must be take the media and thumbnails images from the original site.
I have opened the includes/constants.php
Try to change these but it cant work

define('MEDIA_DIR', '/data/media');
define('THUMB_TEMP_DIR', '/data/tmp_thumbnails');

with

define('MEDIA_DIR', 'xxx.com/data/media');
define('THUMB_TEMP_DIR', 'xxx.com/data/tmp_thumbnails');

How can i do it?

Offline Sunny C.

  • Addicted member
  • ******
  • Posts: 1.806
  • I ♥ 4I
    • View Profile

Offline twiter

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Re: Using same DB for 2 sites.
« Reply #2 on: July 14, 2010, 04:32:17 PM »
I looked there but I dont want different table prefixes or logins. I just add new images from the original sites, but it seems the second site automatically,
I have copied all site to other domain If I am going to copy data/media and data/thumbnailer files it works fine but every new image I have to upload it on the new site, I dont want to upload it again.


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: Using same DB for 2 sites.
« Reply #3 on: July 14, 2010, 11:41:35 PM »
If you have two galleries at
/home/user/twiter/htdocs/4images1/
and
/home/user/twiter/htdocs/4images2/

and all your images are located at
/home/user/twiter/htdocs/4images1/data/
then in your second gallery use relative paths such as:

define('MEDIA_DIR', '../4images1/data/media');
define('THUMB_TEMP_DIR', '../4images1/data/tmp_thumbnails');

Note, that both galleries must be available from either of the domains. Otherwise you'll have to talk to your provider to setup virtual directory in your second gallery to access files from first gallery.

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 twiter

  • Jr. Member
  • **
  • Posts: 51
    • View Profile
Re: Using same DB for 2 sites.
« Reply #4 on: July 15, 2010, 10:54:02 AM »
I tried it but it doesnt work for me,

when I try this
define('MEDIA_DIR', '../xxx/data/media');
define('THUMB_TEMP_DIR', '../xxx/data/tmp_thumbnails');

image not shown and when I look source the image shown as

newsitedomain.com/../xxx/data/media/1.jpg

If I try this

define('MEDIA_DIR', '../xxx.com/data/media');
define('THUMB_TEMP_DIR', '../xxx.com/data/tmp_thumbnails');

Image seen in the page as;

newsitedomain.com/../xxx.com/data/media/1.jpg