473,791 Members | 2,901 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using PHP to proxy access to streaming source

Hi all,

Anybody tried this? Know of any published work on the topic? More
specifically, I am have a webcam (hardware device which connects directly
to the network) which will be behind a public webserver (LAMP). The
webserver will serve up predominantly static content. I want it to mediate
access to the camera for security reasons (camera control is exposed via
HTTP, also provides different URLs for different protocols / resolutions)
to manage bandwidth more cleverly.
TIA,

C.
Jul 17 '05 #1
1 4183
Colin McKinnon <Colin McKinnon <co************ **@andthis.mms3 .com>> wrote:
Anybody tried this? Know of any published work on the topic? More
specifically, I am have a webcam (hardware device which connects directly
to the network) which will be behind a public webserver (LAMP). The
webserver will serve up predominantly static content. I want it to mediate
access to the camera for security reasons (camera control is exposed via
HTTP, also provides different URLs for different protocols / resolutions)
to manage bandwidth more cleverly.

I hope I got this right: The webcam capture is an image, obtainable through
HTTP? If so, you could grab the image using file_get_conten ts() and then
open and resize it using the gd library <http://www.php.net/gd>. Either on
demand on the server or invoked as a cronjob every x minutes.
I understand "different protocols" as "HTTP, FTP, maybe some more", so you
would need the image as file(s) on the hard disk. Since you can't check for
requests to the image via FTP (as long as you don't use special software) I
would suggest using the cronjob and a command line script (untested!):
(You need PHP as binary to do so!)

<?php
set_time_limit( 0); // could take some time ;)
// getting the original image
$image = file_get_conten ts('http://webcamserver/path/to/webcamshot.jpg' );
fwrite($f = fopen('original .jpg', 'w'), $image);
fclose($f); unset($image);

// the width of the resized images
// (height will be calculated)
$resolutions = array(
400,
320,
240,
160,
80 // no comma here!
);

// opening the original image
$orig = ImageCreateFrom JPEG('original. jpg');
$ow = ImageSX($orig);
$oh = ImageSY($orig);
$ratio= ((float) $oh) / ((float) $ow);
$path = 'path/to/public/images/';

foreach ($resolutions as $w) {
$h = round($ratio * $w);
$im = ImageCreateTrue Color($w, $h);
ImageCopyResamp led($im, $dest, 0, 0, 0, 0, $w, $h, $ow, $oh);
ImageJPEG($im,$ path.$w.'.jpeg' ,80);
ImageDestroy($i m);
}

?>

--
Simon Stienen <http://dangerouscat.ne t> <http://slashlife.de>
»What you do in this world is a matter of no consequence,
The question is, what can you make people believe that you have done.«
-- Sherlock Holmes in "A Study in Scarlet" by Sir Arthur Conan Doyle
Jul 17 '05 #2

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

Similar topics

4
17740
by: Fuzzyman | last post by:
In a nutshell - the question I'm asking is, how do I make a socket conenction go via a proxy server ? All our internet traffic has to go through a proxy-server at location 'dav-serv:8080' and I need to make a socket connection through it. The reason (with code example) is as follows : I am hacking "Tiny HTTP Proxy" by SUZUKI Hisao to make an http proxy that modifies URLs. I haven't got very far - having started from zero knowledge of...
6
1732
by: John Sheppard | last post by:
Hello there, I am unsure as to where to ask for help about this, so I thought I might try here. Our website works correctly for 99.9% of customers, however we have one set of customers who access our website from what appears to be a proxy server of some kind. i.e. The IP address is always the same no matter where the location of the computer is.
6
2229
by: Evan David Light | last post by:
After agonizing over this problem for a few days, I've decided to seek help. No, not the variety that involes a jacket that zips up the back but this august body of intrepid individuals. I've discovered the following: - My compile line should resemble: CC -D_PTHREADS -D_POSIX_C_SOURCE=199506L -LANG:std -n32 -mips3 -c <src> -o <obj> - My link line should resemble: CC -LANG:std -n32 -mips3 <objs> -o <executable> -lpthread
1
1963
by: tasa3dit | last post by:
hi i've to develop a streaming proxy for rtsp and i've some questions : - how can i know from rtsp requests and responses if the stream is direct (live) or differred? - how can implement authentication mechanisms? i know there header for this but i don't know how (the clients connecting to the proxy must give a username/password) - how can i integrate mms and pna? is there any specification of these protocols? thx
5
3487
by: Benne Smith | last post by:
Hi, I have three enviroments; a development, a testing and a production enviroment. I'm making a big application (.exe), which uses alot of different webservices. I don't use the webservices by adding a WebReference, since it does not allow me to keep state (cookiecontainer) or to specify functions on the classes (like if i want to override the ToString() function on a class from my webservice). So the only way i can see how i can get...
0
2643
by: George | last post by:
Hello, I'm running an ASPX application "WebApplication1" which consumes a web service (service1.asmx) hosted on a machine with IP (128.1.7.x) . The web service is located in the intranet. The web methods can be invoked successfully if "WebApplication1" is located in machines with the same subnet (128.1.7.x). However, it fails if "WebApplication1" is hosted on
6
1267
by: Bob Weiner | last post by:
I have a few dll's that return their own version of Account objects. In the asp code I am writing now I would like to define an interface, called IAccount, and convert each of these objects ( dll1.Account, dll2.Account...) upon return so I can deal with them synonymously. The type conversion is not allowed and I'm not sure how to work around it. I'm using C# in VS2005. Thanks, bob
0
1124
by: reco | last post by:
Hi, I am only new to development and have been given a task to convert a Perl script to a Windows Service. The issue I am facing is that the current Perl Script uses a SOAP call to an Apache Web Server to retrieve data through https xml feeds. I am unable to locate any help on how to write this in c#. I am using Visual Studios 2005. I have provided part of the Perl Script if it helps (I have altered the proxy and uri for security reasons)....
4
4469
by: Jon | last post by:
I wrote a VS 2005 C# express programme that accesses a web service. It works fine when there's a direct connection to the internet, but on two different PCs with internet access via a proxy, I get this exception: System.Net.WebException: The request failed with HTTP status 407: Proxy Authentication Required. at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream...
0
9515
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,...
1
10154
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9993
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...
1
7537
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
6776
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
5430
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...
0
5558
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3713
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2913
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.