473,625 Members | 3,201 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CMS with media content on another server

Ok, so I'm the author of a pretty big CMS system (big as in huge, not
market-share big) and I've been thinking about a problem for a few
weeks here on media management.

The CMS accomodates both images/media uploaded by admins, but also by
members (in forum and blogs and such). Nothing strange about that at
all.

But now I'm faced with the need of moving - physically - all my media
to a separate server, for distributed loads. I.e. when deploying the
CMS you can either set localhost or media.exampel.c om as your media
repository.

This makes for two problems - as far as I can think of:

1. Upload

Upon surfing to www.example.com, and uploading an image - the image
has to be moved to media.example.c om after it has been uploaded to the
first server. Right? The media has to be moved first from the client,
to the www server and then from the www server to the media server. As
far as I can tell, there is no other way to do this. I have several
functions to handle uploaded files, the most important one is:

move_file($orig inal_path, $to_dir);

And to handle this, this function has to know when media server isn't
"localhost" and facilitate the transfer to the other server, maybe by
a second POST to media.example.c om?
2. <imgtags

The next problem is when the PHP script should output an image that is
physically located on another machine. Today, I use imagemagick to
convert it to the wanted size and geometry and saves it in a cache
directory and then outputs a <imgtag that points to this directory.

With the file on another server, the PHP script on the www server can
only output something along the lines of:

<img src='http://media.example.c om/img.php?path=/path/to/file.jpg'>

For example. And img.php on media.example.c om will do all the
conversions needed (in accordance to whatever size or geometry
specifications sent along in the IMG tag).

But, this isn't valid HTML. the <imgtag should always contain
width/height parameters or it will not validate. Not that my code
validates perfectly anyway, but I rather have this information since
it speeds up parsing by the browser as well.

Is there anyone out there that has done something like this before and
knows a good way to get something that isn't half-bad?

--
Sandman[.net]
Feb 26 '07 #1
2 1834
On Mon, 26 Feb 2007 16:10:54 +0100, Sandman <mr@sandman.net wrote:
Ok, so I'm the author of a pretty big CMS system (big as in huge, not
market-share big) and I've been thinking about a problem for a few
weeks here on media management.

The CMS accomodates both images/media uploaded by admins, but also by
members (in forum and blogs and such). Nothing strange about that at
all.

But now I'm faced with the need of moving - physically - all my media
to a separate server, for distributed loads. I.e. when deploying the
CMS you can either set localhost or media.exampel.c om as your media
repository.

This makes for two problems - as far as I can think of:

1. Upload

Upon surfing to www.example.com, and uploading an image - the image
has to be moved to media.example.c om after it has been uploaded to the
first server. Right? The media has to be moved first from the client,
to the www server and then from the www server to the media server. As
far as I can tell, there is no other way to do this. I have several
functions to handle uploaded files, the most important one is:

move_file($orig inal_path, $to_dir);

And to handle this, this function has to know when media server isn't
"localhost" and facilitate the transfer to the other server, maybe by
a second POST to media.example.c om?
Have you thought of setting up a synchronisation mechanism? You could code
a directory watcher that periodically looks for changes in a directory and
then copies those changes to the remote system. You could do that
directly, but you could also use a synchronisation command catcher on the
remote system, that reacts for instance to SOAP XML requests and then
performs the commands locally. That way you can implement a security
mechanism to prevent abuse.
>
2. <imgtags

The next problem is when the PHP script should output an image that is
physically located on another machine. Today, I use imagemagick to
convert it to the wanted size and geometry and saves it in a cache
directory and then outputs a <imgtag that points to this directory.

With the file on another server, the PHP script on the www server can
only output something along the lines of:

<img src='http://media.example.c om/img.php?path=/path/to/file.jpg'>

For example. And img.php on media.example.c om will do all the
conversions needed (in accordance to whatever size or geometry
specifications sent along in the IMG tag).

But, this isn't valid HTML. the <imgtag should always contain
width/height parameters or it will not validate. Not that my code
validates perfectly anyway, but I rather have this information since
it speeds up parsing by the browser as well.

Is there anyone out there that has done something like this before and
knows a good way to get something that isn't half-bad?
Height and width are implied for html 4.01, meaning you can omit them
safely, and still have the document validate. The image element will then
be displayed at the size of its source, unless you control it using CSS,
for instance.

--
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
Feb 26 '07 #2
In article <op************ ***@cp139795-a.landg1.lb.hom e.nl>,
OmegaJunior <om*********@sp amremove.home.n lwrote:
1. Upload

Upon surfing to www.example.com, and uploading an image - the image
has to be moved to media.example.c om after it has been uploaded to the
first server. Right? The media has to be moved first from the client,
to the www server and then from the www server to the media server. As
far as I can tell, there is no other way to do this. I have several
functions to handle uploaded files, the most important one is:

move_file($orig inal_path, $to_dir);

And to handle this, this function has to know when media server isn't
"localhost" and facilitate the transfer to the other server, maybe by
a second POST to media.example.c om?

Have you thought of setting up a synchronisation mechanism? You could code
a directory watcher that periodically looks for changes in a directory and
then copies those changes to the remote system. You could do that
directly, but you could also use a synchronisation command catcher on the
remote system, that reacts for instance to SOAP XML requests and then
performs the commands locally. That way you can implement a security
mechanism to prevent abuse.
Well - the media shouldn't be kept on server1. It should have no media
files. All should be on server2. So files uploaded to server1 should
automatically be forwarded to server2 instantly and then be erased on
server1.
2. <imgtags

The next problem is when the PHP script should output an image that is
physically located on another machine. Today, I use imagemagick to
convert it to the wanted size and geometry and saves it in a cache
directory and then outputs a <imgtag that points to this directory.

With the file on another server, the PHP script on the www server can
only output something along the lines of:

<img src='http://media.example.c om/img.php?path=/path/to/file.jpg'>

For example. And img.php on media.example.c om will do all the
conversions needed (in accordance to whatever size or geometry
specifications sent along in the IMG tag).

But, this isn't valid HTML. the <imgtag should always contain
width/height parameters or it will not validate. Not that my code
validates perfectly anyway, but I rather have this information since
it speeds up parsing by the browser as well.

Is there anyone out there that has done something like this before and
knows a good way to get something that isn't half-bad?

Height and width are implied for html 4.01, meaning you can omit them
safely, and still have the document validate. The image element will then
be displayed at the size of its source, unless you control it using CSS,
for instance.
Yeah, but it speeds up the browser to not have to wait for the image
data before positioning it on the canvas.

Either way, I've gotten this far:

1. Client connects to index.php on server1
2. index.php uses function img()
3. img() takes a image path from the database
4. img() sends a HTTP request to server2/img.php
5. img.php resizes original image at given path
6. img.php caches resized image on server2
7. img.php responds with "width height path-to-cache"
8. img() outputs a <imgtag with above properties
9. client connects to server2 to fetch the image

This way, only two PHP requests has been made, and one file request.

--
Sandman[.net]
Feb 27 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2003
by: Jason Richmeier | last post by:
I looked for a more appropriate newsgroup for this question but I didn't see much of anything (something more specific to Windows Media Services). I have a server with Windows Media Services. When I try to establish an ASP ..NET application and open a page in this application, an attempt is made to open the page using Media Player (I am guessing that the server thinks the page should be served as a streaming media clip). Is there a way...
4
6277
by: hzgt9b | last post by:
Using VS 2003, VB.NET and/or ASP.NET 2.0, BACKGROUND I have a window forms based application that contains a TreeView control and a WebBroswer (AxSHDocVw.AxWebBrowser) control. The TreeView is populated with nodes that when clicked play an audio clip from specified local or web URL and navigate the browser control to a specified local or web URL. Audio playback uses as hidden media player object AxWMPLib.AxWindowsMediaPlayer).
1
1950
by: vera esaulova | last post by:
I have problem whis Windows Media Services 9 Series. I have videostream, which will consist of two streams(512k/bit and 256k/bit).I need to allocate a stream 256k/bit. In SDK is written: Supporting Multiple Bit Rate Files Several versions of the same audio or video content can be stored in separate streams, encoded at different bit rates, in a Windows Media file. When a Windows Media player connects to an origin server, it requests...
2
3271
riptide2049
by: riptide2049 | last post by:
I really have a problem here. I have a code that is suppost to take the href of a link from the right class;value of a link maked toreturn false. the value is a Media file the file is sent to quicktime or windows meida player depending on which plugin was found. after the plug in is found a iframe with the right player is created. here is the code. for some reason In IE the plug in doesnt work and in fire fox it crashes <!DOCTYPE html...
0
2030
by: Konrad | last post by:
Hi everyone. I've got problem with converting xml file to xsd schema. The Xml file looks like: <?xml version="1.0" encoding="iso-8859-2"?> <rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/"> <channel> <title>Song Site</title> <media:title type="plain">TitleOfMedia</media:title> <link>http://www.foo.com</link> <description>Songs galore at different bitrates</description>
0
1582
by: kplazinski | last post by:
Hi everyone. I've got problem with converting xml file to xsd schema. The Xml file looks like: <?xml version="1.0" encoding="iso-8859-2"?> <rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/"> <channel> <title>Song Site</title> <media:title type="plain">TitleOfMedia</media:title> <link>http://www.foo.com</link> <description>Songs galore at different bitrates</description>
0
1577
by: kplazinski | last post by:
Hi everyone. I've got problem with converting xml file to xsd schema. The Xml file looks like: <?xml version="1.0" encoding="iso-8859-2"?> <rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/"> <channel> <title>Song Site</title> <media:title type="plain">TitleOfMedia</media:title> <link>http://www.foo.com</link> <description>Songs galore at different bitrates</description>
3
1718
by: Robert Dunlop | last post by:
I am using Microsoft Visual Studio 2005 for development of an ASP.NET site, and I have a problem that greatly effects my workflow at times. It seems that after I upload new files anywhere within the directory structure of the site that is visible to VS, the next time I perform a build VS takes extra time, apparently downloading the new files (though the time required seems much longer than a one-time download should take). During this...
0
8253
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8189
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8692
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8497
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7182
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6116
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4089
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.