Coding Help requested for webcam

Post Reply
User avatar
WyoDog
Advisor
Advisor
Posts: 67
Joined: Wed Aug 23, 2017 6:39 pm
Location: Powell, WY USA
Station model: Davis Pro2
Software: Weather Display
Contact:

Coding Help requested for webcam

Post by WyoDog » Tue Nov 21, 2017 9:45 pm

My web coding skills are very lacking using .php & CSS. I am hoping that someone can assist me with the webcam block.

I use a NEST camera which is hosted on their site so I have no control over URL etc. I can access this camera at https://video.nest.com/live/5lCxaI7Qi6, So I used that URL in block setup, but nothing loaded.

NEST also provided the following code to embed on the site.

<iframe type="text/html" frameborder="0" width="480" height="394" src="//video.nest.com/embedded/live/5lCxaI7Qi6?autoplay=1" allowfullscreen></iframe>

===================================================================
I placed this line in webcamBlock.php as such:

</style>
<div class="divIcon" style="top:5px;left:5px;width:13%">
<img src='homepage/blocks/webcam/icons/<?php echo $theme?>/webcam.png' style="max-width:30px;width:100%" alt=''>
</div>
<br>
<?php
for($i=0;$i<count($webcamURLs);$i++){
if(trim($webcamPositions[$i])=="-"){
$showPositions = false;
}
else{
$showPositions = true;
$positions = explode(',',$webcamPositions[$i]);
}
?>

<iframe type="text/html" frameborder="0" width="274" height="225" src="//video.nest.com/embedded/live/5lCxaI7Qi6?autoplay=1" allowfullscreen></iframe>

<span style="font-size:1.3em;font-weight:bold;font-variant:small-caps">
<?php echo $webcamTitles[$i]?>
</span><br><br>
<div style="width:100%;position:relative">
<img id="webcamImage<?php echo $i?>" src="<?php echo $webcamURLs[$i]?>" class="webcamImg tooltip" alt='' title="<?php echo $webcamTitles[$i]?>" onclick='zoomWebcam("webcamImage<?php echo $i?>")'>
<?php

===============================================================

I totally kludged this code. I'm not proud of it but it works, kind of. I changed the size of the image to fit on my page.

Obviously, this doesn't scale as everything else that Jachym has created. Is there a fix for my abomination without rewriting the block? I certainly don't expect anyone to do that. Is there a cut and paste solution?
Attachments
webcamBlock.png
webcamBlock.png (101.21 KiB) Viewed 4156 times
Terry

Image

User avatar
Jachym
Site Admin
Site Admin
Posts: 1686
Joined: Fri Aug 18, 2017 10:12 pm
Location: Brno, Czech Republic
Station model: WH1080
Software: Meteobridge
Contact:

Re: Coding Help requested for webcam

Post by Jachym » Tue Nov 21, 2017 9:59 pm

Hi,
the problem is in the iframe fixed dimensions. Change it for example like this:

<iframe type="text/html" frameborder="0" style="width:98%;margin:0 auto" src="//video.nest.com/embedded/live/5lCxaI7Qi6?autoplay=1" allowfullscreen></iframe><br>

User avatar
WyoDog
Advisor
Advisor
Posts: 67
Joined: Wed Aug 23, 2017 6:39 pm
Location: Powell, WY USA
Station model: Davis Pro2
Software: Weather Display
Contact:

Re: Coding Help requested for webcam

Post by WyoDog » Wed Nov 22, 2017 12:07 am

Thank you, Jachym. That did the trick

Have you had a chance to think about the background color of the snowblock?

viewtopic.php?f=56&t=438#p2931
Terry

Image

Post Reply