Hi, I’m new here not so much new to SitePoint but new to the forums. I have recently taken a new job and I’ll be developing multiple sites based off of one database.
I will have multiple websites pulling data from one database but what I would like is one site for creating the datasets. But I have a problem. At current I am storing images on a location on the web server when they are uploaded. I am currently only storing the end file name of the image in the database. ie(somefile.jpg).
From what you explain, a few solutions come to mind, though you may not have the freedom to address them all given your requirements:
Create a subdomain (or other domain) for image hosting: images.domain.com. Simply host all images on that subdomain site.
You could rewrite the URL when requesting images. So if you store everything in /websiteone.com/images, place a .htaccess file in /websitetwo.com/images that rewrites any request back to /websiteone.com/images but requests that same file name, just change the path.
You could store the images in the database rather than the filesystem, but I would recommend against this. For no other reason than it’s more difficult (from my perspective) to manage and debug. I’m sure some SQL folks on here could argue this one.
Or…just use hardlinks. Simple, let the underlying filesystem handle it.
Or…depending on the server configure it to use a virtual directory that points to the real thing.
#1 There is actually another link but I’d like it be on the intranet for extra safety. Though there is a possibility that it needs a public sub domain as well. Though I don’t really want those links to show up as that.
#2 How would I go about rewriting this rule? my .httaccess is rusty.
#3 This doesn’t seem like a good solution to me either. Seems like it would take query times up as multiple images will be used.
hardlinks? You mean actually write htttp://blahblah/images.jpg etc? They are already hard links The problem is I don’t want the other websites to know about the dataset one.
virtual directory - I will have to talk to my IT guy and ask him if this is possible, this might be the best solution if it’s doable.
Thank you both for your assistance it has given me some thoughts on where to continue looking.