FinWX Foorumi

Koodaus- ja rakentelunurkka => Sivustojen koodaaminen (HTML, PHP, MySQL, jne.) => Aiheen aloitti: Tuffe - perjantai, 26.04.2013, 17:32

Otsikko: verkkokamera script (säätiedot poissa)
Kirjoitti: Tuffe - perjantai, 26.04.2013, 17:32
 Otin käyttöön verkkokamera scriptin   täältä http://www.finwx.net/forum/index.php/topic,1959.0.html mutta kuva näkyy, säätiedot poissa .
Kuvan alalaidassa on kuitenkin tumma palkki.
ei suostunna toimimaan, toisaalta miten kello webkamera kuvaan liitetään?,

ps. tämä script olisi erinomainen kuvasarjaan


-tufffe-
Otsikko: Vs: verkkokamera script (säätiedot poissa)
Kirjoitti: angle - perjantai, 26.04.2013, 21:23
Oiskohan tekstit vaan sijoittunut kuvan ulkopuolelle? Oletko kokeillut rukata tekstin sijaintia?
Otsikko: Vs: verkkokamera script (säätiedot poissa)
Kirjoitti: oldpet - perjantai, 26.04.2013, 21:42
Joo näin oli ainakin itsellä koska defaul kuva oli eri resoluutiolla kun scriptissä.
Otsikko: Vs: verkkokamera script (säätiedot poissa)
Kirjoitti: Tuffe - perjantai, 26.04.2013, 21:58
Kuvan koko 640*480 kokeilin myös 900*600 samalla tuloksella
nyt kuvankoko  nyt 640*480
miten kuvan asetukset koodissa kuvakoolle 640*480?

koodia =>
$grey = imagecolorallocate ($im2, 166, 166, 166);

$black = imagecolorallocate ($im2, 0,0,0);



$str = $cstring.' - '.$bstring.' - '.$astring;

$transparent = imagecolorallocatealpha($im2, 0,0,0, 50);




imagefilledrectangle($im2, 0, 460, 640, 480, $transparent);

imagettftext($im2, 11, 0, 5, 459, $grey, $font, $str);



header("Content-Type: image/jpeg");

--------------------------------------------------------------------------------------

Miten saan säätiedot näkymään webkuvaan?
Otsikko: Vs: verkkokamera script (säätiedot poissa)
Kirjoitti: oldpet - perjantai, 26.04.2013, 22:31
Kokeile tuon 459 paikalle vaihtaa 476. Itellä on 320x240 kuva ja 238 osuu kohilleen.
Otsikko: Vs: verkkokamera script (säätiedot poissa)
Kirjoitti: Tuffe - lauantai, 27.04.2013, 03:10
alalaidan tumman pohjan säädöt toimii,mutta säätietoja ei viellä näy

<?php

$image 
"http://axxxx.xx/fi/live/update_10min.jpg";

$font "tahomabd.ttf";

$clientrawfile "./realtime.txt";

$cstring "axxx.xx";



/*

if(!isset($PHP_SELF)) {$PHP_SELF = $_SERVER['PHP_SELF']; }

$t = pathinfo($PHP_SELF);

$Program = $t['basename'];

$ourHost = str_replace('', '', $_SERVER[HTTP_HOST]);

$mc = parse_url($_SERVER['HTTP_REFERER']);

$masterHost = $mc['host'];

if ($ourHost <> $masterHost) { exit;}

*/



date_default_timezone_set("Europe/Helsinki");

$clientraw get_raw($clientrawfile);

$astringwindDir($clientraw[11]) . " " $clientraw[6] . " m/s, ".$clientraw[2]."°C, "$clientraw[9]." mm";

$bstring date('d.m.Y H:i:s T');



$ext substr($image, -3);



if (
strtolower($ext) == "gif") {

    if (!
$im2 imagecreatefromgif($image)) {

        echo 
"Error opening $image!"; exit;

    }

} else if(
strtolower($ext) == "jpg") {

    if (!
$im2 imagecreatefromjpeg($image)) {

        echo 
"Error opening $image!"; exit;

    }

} else if(
strtolower($ext) == "png") {

    if (!
$im2 imagecreatefrompng($image)) {

        echo 
"Error opening $image!"; exit;

    }

} else {

    die;

}



$grey imagecolorallocate ($im2166166166);

$black imagecolorallocate ($im20,0,0);



$str $cstring.' - '.$bstring.' - '.$astring;

$transparent imagecolorallocatealpha($im20,0,050);



imagefilledrectangle($im20460640480$transparent);

imagettftext($im211010475$grey$font$str);



header("Content-Type: image/jpeg");

imagejpeg($im2);

imagedestroy($im2);



function 
get_raw$rawfile ) {

        
$rawdata implode(''file($rawfile));

        
$rawdata explode(' '$rawdata);

        return 
$rawdata;

}



function 
ktsToMph ($kts$prec) {

          
$prec = (integer)$prec;

          
$inch = (float)$kts 0.514444444;

          return 
round($inch1);

}



function 
windDir ($winddir)

// Given the wind direction, return the text label

// for that value.  16 point compass

{

  if (!isset(
$winddir)) {

    return 
"---";

  }

$windlabel = array ("N","NNE""NE""ENE""E""ESE""SE""SSE""S",

   
"SSW","SW""WSW""W""WNN""NW""NNW");

$dir $windlabel[ (int) ($winddir 22.5) ];

return 
"$dir";

}

exit;

?>

Otsikko: Vs: verkkokamera script (säätiedot poissa)
Kirjoitti: oldpet - lauantai, 27.04.2013, 10:44
Testailin vähän tuota ja sulla puuttuu tuo fonttitiedosto. Laita se fonttitiedosto tahomabd.ttf tuohon samaan kansioon ja korjaa tuohon riville

$font = "./tahomabd.ttf";
Otsikko: Vs: verkkokamera script (säätiedot poissa)
Kirjoitti: Tuffe - lauantai, 27.04.2013, 11:15
JES Jes nyt toimii!
thanks:)
Otsikko: Vs: verkkokamera script (säätiedot poissa)
Kirjoitti: angle - lauantai, 27.04.2013, 11:24
Näyttäisi toimivan hienosti. Mites olet tehnyt tuon kelikamera-animaation sun sivuilla?
Otsikko: Vs: verkkokamera script (säätiedot poissa)
Kirjoitti: Tuffe - maanantai, 29.04.2013, 08:22
Löysin scripitin täältä  http://code.google.com/p/simple-webcam-image-archive/