Jump to content

bsamson

Members
  • Posts

    150
  • Joined

  • Last visited

Everything posted by bsamson

  1. The image, without it nothing is displayed.
  2. From what I understand $frame is the image. I have searched and searched for a solution. Thanks in advance for the assistance! Best Regards, Brian
  3. Craygo, Thanks for the help. However, that part of the script is only ran IF the URL (i.e.: http://11.11.11.11:1024/img/video.mjpeg) is not found. Here is the script w/ that section removed that I just tested and works: <?php $camurl="http://11.11.11.11:1024/img/video.mjpeg"; $boundary="\n--"; $f = fopen($camurl,"r"); //**** URL OK // Transfer the image... while (substr_count($r,"Content-Length") != 2) $r.=fread($f,512); $start = strpos($r,'ÿ'); $end = strpos($r,$boundary,$start)-1; $frame = substr("$r",$start,$end - $start); header("Content-type: image/jpeg"); echo $frame; fclose($f); ?> Thanks again for the help, any other suggestions? Best, Brian
  4. I am a bit lost ... what do you mean image is above that? Thanks in advance. --Brian
  5. Appreciate the advice. However, I believe the problem is the fact that the image stored in $frame is not jpeg? That is just a shot in the dark because of this error: Warning: imagejpeg(): supplied argument is not a valid Image resource in /home/nnyserve/public_html/backend/cams/scripts/grabStill-2.php on line 26 Any advise? Thanks in advance!
  6. Ok. Here's another approach ... (that isn't working) ... <?php $camurl="http://123.123.123.123:1024/img/video.mjpeg"; $boundary="\n--"; $f = fopen($camurl,"r") ; if(!$f) { //**** cannot open echo "error"; } else { //**** URL OK while (substr_count($r,"Content-Length") != 2) $r.=fread($f,512); $start = strpos($r,'ÿ'); $end = strpos($r,$boundary,$start)-1; $frame = substr("$r",$start,$end - $start); header("Content-type: image/jpeg"); imagejpeg($frame); } fclose($f); ?> This script displays this error: Warning: imagejpeg(): supplied argument is not a valid Image resource in /home/nnyserve/public_html/backend/cams/scripts/grabStill-2.php on line 29 Any suggestions? Im sorry, but I have not worked much w/ PHP & images. Again, it's all I want to do is to save the frame that is captured. That side of the script works. Thanks in advance for any assistance! Best Regards, Brian
  7. Thanks for all the help! However, unfortunately the script doesn't want to save the image. Gives me errors indicating folder not found. Anyway, I also tried to use the IMAGEJPEG function ... but errors indicate that it doesn't recognize the format. Any one have any other suggestions as I am not yet too familiar with working with images in PHP. Thanks in advance!!! -Brian
  8. Good Afternoon, I found the following script which grabs a still image from an mjpeg video stream. <? // an IP address $dest = "123.123.123.123"; if ($_GET['view']=="1") { $view = ":1024"; } elseif ($_GET['view']=="2") { $view = ":1025"; } $camurl="http://".$dest.$view."/img/video.mjpeg"; $boundary="\n--"; $f = fopen($camurl,"r"); if( ! $f ) { //**** Failed opening the socket if( function_exists( 'imagecreatetruecolor' ) && $img = imagecreatetruecolor( 320, 200 ) ) { // Display an image if we have GD $logo = imagecreatefromgif( "http://www.mydomain.com/backend/cams/img/errorConnecting.jpg" ); $font = 1; header( "Content-type: image/jpeg" ); imagealphablending( $img, 1 ); imagealphablending( $logo, 1 ); $img_w = imagesx( $img ); $img_h = imagesy( $img ); $logo_w = imagesx( $logo ); $logo_h = imagesy( $logo ); $bgc = imagecolorallocate( $img, 255, 255, 255 ); $tc = imagecolorallocate( $img, 0, 0, 0 ); $dc = imagecolorallocate( $img, 255, 0, 0 ); imagefill( $img, 0, 0, $bgc ); imagerectangle( $img, 0, 0, $img_w-1, $img_h-1, $dc ); imageline( $img, 0, 0, $img_w-1, $img_h-1, $dc ); imageline( $img, 0, $img_h-1, $img_w-1, 0, $dc ); imagecopy( $img, $logo, 0, 0, 0, 0, $logo_w, $logo_h ); imagestring( $img, $font, 5, $logo_h, "Error accessing $camurl", $tc ); $date = time(); $date = date( 'Ymd-His (O T)', $date ); imagestring( $img, $font, 5, $logo_h + imagefontheight( $font ) + 1, $date, $tc ); imagejpeg( $img ); imagedestroy( $img ); imagedestroy( $logo ); } else { // Display an error if we do not have GD header( "Content-type: text/html" ); echo "<html><body><h1>Error</h1>Error accessing $camurl"; echo "</body></html>"; } } else { //**** URL OK // Transfer the image... while (substr_count($r,"Content-Length") != 2) $r.=fread($f,512); $start = strpos($r,'ÿ'); $end = strpos($r,$boundary,$start)-1; $frame = substr("$r",$start,$end - $start); header("Content-type: image/jpeg"); echo $frame; } fclose($f); ?> And this works well. However, we have 20+ cams and load time is of concern. What I am looking to do is to adjust this script to save the image NOT display it. Any assistance would be greatly appreciated! Thanks!
  9. Let me clarify ... Let's go with these fields instead: ID ENTRYDATE STORE NEWACTS UPGACTS How do I add all the new acts for each store then grab the the store with the highest new acts?
  10. Try: <?php //Put date values together $slash='/'; $doa=$doamonth.$slash.$doaday.$slash.$doayear; echo $doa; ?>
  11. Hello, I have a DB named REPORTS. Here's the structure ... ID ENTRYDATE STORE NEWACTS 12MOACTS 22MOACTS Basically this is a small internal website that serves 20 stores. Each store has to complete a report on the site every night that gets put into the DB. Each store is assigned a STORE # which is what is stored in the STORE field. The number never changes and is unique to that store. Every Store completes this report every night. Now, I need to create a PHP script that computes how many NEW activations(month to date) each store has done and display the top 2 stores. This needs to be repeated for 12MOACTS and 22MOACTS. By the way, the NEWACTS, 12MOACTS, and 22MOACTS are new activations which are reported daily. Any help will be GREATLY appreciated! Thanks!
  12. Thanks for the clarification! It's working great!
  13. I have the following script: <?php // Get last 3 months for search criteria $longMonth1 = date("M Y"); $longMonth2 = date("M Y",strtotime("-1 month")); echo $longMonth1."<br>".$longMonth2; ?> This was working fine the other day, however today (03/31/2008) it is displaying: Mar 2008 Mar 2008 It should display: Mar 2008 Feb 2008 Any suggestions will be greatly appreciated!
  14. I have a MySQL table structured like so: id entrydate location morningTraffic afternoonTraffic eveningTraffic The entrydate field is stored in MySQL date format Like so: 2008/03/08 I have a form requesting this info: MONTH / LOCATION I used the following php to list the current and 2 previous months: <?php // Get last 3 months for search criteria $mnth1 = date("F"); $mnth2 = date("F",strtotime("-1 month")); $mnth3 = date("F",strtotime("-2 months")); ?> Then I have this HTML/PHP displaying the info: <select size="1" name="month"> <option value="<? echo $mnth1; ?>"><? echo $mnth1; ?></option> <option value="<? echo $mnth2; ?>"><? echo $mnth2; ?></option> <option value="<? echo $mnth3; ?>"><? echo $mnth3; ?></option> </select> How do I create a query to search the date field for the month only?? Any ideas would be greatly appreciated! Thanks. Best Regards, bsamson
  15. I dont know sensitive was the right word. The links redirect the user (and auto logins) to an activation site for a wireless carrier. We like this option b/c users dont know the passwords. Is there perphaps a ceritificate of some kind that I can have php look at before loading? Or perhaps use javascript to get contents of file? I am at a loss ... because everything as of right now is wrapped around the store's ip. Thanks in advance.
  16. Here's the situation. I run a small internal website that I have coded from scratch for my company. Right now it is IP based and stores automatically get logged in. HOWEVER, some stores don't have a static IP and it changes seemingly everyday. This site contact links that auto log the user into some pretty sensitive sites. I was curious if there is a method of storing a file on each stores computer that a script will read and validate based on that. Any help will be greatly appreciated! Thanks in advance! --Brian
  17. Hello. I have a DATE field in MySQL. So I have a date formated like: 2008/01/22 I have this line @ the beginning of my script: $day2 = date("Y/m/d", time()-(86400 * 2)); Which of course gets the date from 2 days ago. Now I am trying to create another variable w/ it formated like: 01/22/2008. So ... I want to take ... $day2 = "2008/01/19" and make $formated-day2="01/19/2008" How can I do this? I need $day2 to maintain that format for the DB query I am doing elsewhere in the script. Any help would be greatly appreciated! Thanks!
  18. Have a what seems to be simple problem .... I have a DB table that looks like this: Database: MAIN Table: STORE Fields: ID Location-Name 34 Albany 58 Chicago 45 Atlanta I need to create an array thats map to the ID #. For example, I need to create the PHP and MySQL Query that does this: $locname[34] = Albany $locname[58] = Chicago etc ... etc ... etc ... This is the code that I have ... that obviously doesn't work: <?php $db2con = "main"; include "../../scripts/c2d.php"; $queryMAIN = mysql_query("SELECT * FROM stores") or die(mysql_error()); $numstores=mysql_num_rows($queryMAIN); $row = mysql_fetch_assoc($queryMAIN); for ($ct=1;$ct<$numstores+1;$ct++) { $storeid = $row[id]; $storename = $row[location]; $locname[$storeid] = $storename; $storeid = ""; $storename = ""; } ?> I know my logic is flawed because I am not sure how to change the rows ... Please if I can get some help writing this I will appreciated it!
  19. Alright, I have this code: <?php if ($info[depositmade] == "y") { $depositmade = "Yes"; $deptotsquery = mysql_query("SELECT * FROM deposits WHERE ranstr='$info[ranstr]'") or die(mysql_error()); $row = mysql_fetch_assoc($deptotsquery); $deptotal = $row[deptotal]; echo $row[entries]; for ($ct=1;$ct<$row[entries]+1;$ct++) { // Grab Dates $depdatemain = "depdate".$ct; $depdate[$ct] = $row['$depdatemain']; // Grab Amounts $depamtmain = "depamt".$ct; $depamt[$ct] = "$ ".$row['$depamtmain']; } } else { $depositmade = "No"; $deptotal = ""; } ?> Let's assume that $info[depositmade] does equal "y". No apparent errors, however when I do "echo $row[depdate1];" There is no data. Can someone please explain to me why the loop isn't working? I am hoping it's some small! Thanks!
  20. Check out this site ... http://www.somacon.com/p338.php The best way I can think to do it is to create a loop ...
  21. Unfortunetly the above Query doesn't work. Any suggestions?
  22. I am a little confused. Are you suggesting that I do this: <?php $query = mysql_query("SELECT * FROM nightly WHERE DATE(entrydate)=$reqdate"); ?>
  23. Actually I am trying this: <?php $query = mysql_query("SELECT * FROM nightly WHERE DATE_FORMAT(entrydate, '%c/%d/%Y')=$reqdate"); ?> Now, just trying to get it working
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.