Author Topic: Displaying forecast on photocopier  (Read 677 times)

0 Members and 1 Guest are viewing this topic.

Offline uncle_bob

  • Member
  • *
  • Posts: 11
    • Conder Weather
Displaying forecast on photocopier
« on: April 17, 2018, 09:36:31 PM »
Yes, you read that right haha.
Our photocopier can accept a png image or logo on it's screen along with authentication instructions.
I currently have a static image being displayed but thought it would be cool to update it with a current forecast data from a data provider, such as WU

Since my website uses Ken's awesome WU-forecast script, I was hoping than it mightn't be a too bigger job to adapt this to output a png image, instead of a php page.
Is this a really stupid idea?

Cheers for you thoughts in advance,
UB
« Last Edit: April 17, 2018, 09:43:06 PM by uncle_bob »

Offline pfletch101

  • Senior Contributor
  • ****
  • Posts: 242
    • Personal Website
Re: Displaying forecast on photocopier
« Reply #1 on: April 17, 2018, 11:32:54 PM »
How does the image get to the photocopier? If it can be set up to access a 'file' over a network, then you can certainly generate an image in php and point the photocopier to the php script (assuming that it doesn't insist on the file having the right extension for its ostensible type). You can include both graphics and text, but formatting the text is a bit of a pain.
Vantage Pro 2+ with WeatherLink - data incorporated in domestic energy production (PV) and use monitoring system.

Offline uncle_bob

  • Member
  • *
  • Posts: 11
    • Conder Weather
Re: Displaying forecast on photocopier
« Reply #2 on: April 17, 2018, 11:45:33 PM »
Hi Pfletch,
It simply just needs to be in a certain folder on a windows application server. The photocopier app refreshes it's screen from this folder every minute or so.

Offline uncle_bob

  • Member
  • *
  • Posts: 11
    • Conder Weather
Re: Displaying forecast on photocopier
« Reply #3 on: April 18, 2018, 12:14:44 AM »
Here's a pic with the static image. Looks pretty cool but will be better if I can make the info update automagically :)

Offline Bushman

  • Forecaster
  • *****
  • Posts: 6927
    • Eagle Bay Weather
Re: Displaying forecast on photocopier
« Reply #4 on: April 18, 2018, 05:40:57 AM »
Bizarre but neat.  :)

Offline pfletch101

  • Senior Contributor
  • ****
  • Posts: 242
    • Personal Website
Re: Displaying forecast on photocopier
« Reply #5 on: April 18, 2018, 09:32:22 AM »
I have attached a zip of the php script that produces the "solar sticker" in the right hand column of my site at https://fletchers-uk.com/. The "sticker" is just text on a graphic background and is very simple, but the script should give you an idea of how the process works. To write a file instead of sending back the image as an http(s) response, you just need to add a file path argument to the imagepng() call near the end.
Vantage Pro 2+ with WeatherLink - data incorporated in domestic energy production (PV) and use monitoring system.

Offline vreihen

  • El Niņo chaser
  • Forecaster
  • *****
  • Posts: 827
  • K2BIG
Re: Displaying forecast on photocopier
« Reply #6 on: April 18, 2018, 05:32:44 PM »
Where I work, making the copier screen display *anything* would be a bad idea.  Someone would want to take it to the next level and insert ads in place of the forecast.....  #-o
WU Gold Stars for everyone! :lol:

Offline uncle_bob

  • Member
  • *
  • Posts: 11
    • Conder Weather
Re: Displaying forecast on photocopier
« Reply #7 on: April 18, 2018, 05:54:49 PM »
I have attached a zip of the php script that produces the "solar sticker" in the right hand column of my site

Thanks Peter. I'll look into this shortly.

Offline uncle_bob

  • Member
  • *
  • Posts: 11
    • Conder Weather
Re: Displaying forecast on photocopier
« Reply #8 on: April 18, 2018, 05:55:17 PM »
Where I work, making the copier screen display *anything* would be a bad idea.  Someone would want to take it to the next level and insert ads in place of the forecast.....  #-o

Haha, I'd thought of this too :)

Offline uncle_bob

  • Member
  • *
  • Posts: 11
    • Conder Weather
Re: Displaying forecast on photocopier
« Reply #9 on: April 20, 2018, 09:28:09 PM »
ITo write a file instead of sending back the image as an http(s) response, you just need to add a file path argument to the imagepng() call near the end.

Hi Peter, as I'm no coding expert, could you please expand on this?
I've managed to get php to create the formatted table using Kens' WU-forecast and his examples on his website. But getting this table outputted as an image to file is making my head hurt.

If anyone's interested, you can see the table displayed here

Offline Bushman

  • Forecaster
  • *****
  • Posts: 6927
    • Eagle Bay Weather
Re: Displaying forecast on photocopier
« Reply #10 on: April 21, 2018, 02:19:45 AM »
I love the disclaimer! LOL "Never base important decisions on information gleaned from this photocopier"  Sentient machines are among us!!

Offline uncle_bob

  • Member
  • *
  • Posts: 11
    • Conder Weather
Re: Displaying forecast on photocopier
« Reply #11 on: April 21, 2018, 04:03:10 AM »
 :grin: Maybe I should put a smiley on the end of that too

Offline vreihen

  • El Niņo chaser
  • Forecaster
  • *****
  • Posts: 827
  • K2BIG
Re: Displaying forecast on photocopier
« Reply #12 on: April 21, 2018, 08:44:56 AM »
Plenty of different options to make your head hurt even more:

https://stackoverflow.com/questions/757675/website-screenshots

Personally, I like the Google API thingy if you can find a routine to un-JSON the returned screenshot.....
WU Gold Stars for everyone! :lol:

Offline pfletch101

  • Senior Contributor
  • ****
  • Posts: 242
    • Personal Website
Re: Displaying forecast on photocopier
« Reply #13 on: April 21, 2018, 11:25:18 AM »
ITo write a file instead of sending back the image as an http(s) response, you just need to add a file path argument to the imagepng() call near the end.

Hi Peter, as I'm no coding expert, could you please expand on this?

I will send you a PM, since this isn't a PHP coding forum.:-) However, I may not be able to get to this until after the weekend, since there isn't a 'short answer'.
Vantage Pro 2+ with WeatherLink - data incorporated in domestic energy production (PV) and use monitoring system.

Offline Bushman

  • Forecaster
  • *****
  • Posts: 6927
    • Eagle Bay Weather
Re: Displaying forecast on photocopier
« Reply #14 on: April 21, 2018, 12:45:02 PM »
This isn't an answer, but I was curious.  (YOU never know...)  https://codepedia.info/editor-example/jquery-convert-html-to-image-example/

Offline SLOweather

  • Administrator
  • Forecaster
  • *****
  • Posts: 3430
    • http://www.sloweather.com
Re: Displaying forecast on photocopier
« Reply #15 on: April 21, 2018, 12:50:22 PM »
Please feel free to post it here. Lots of other PHP code has been posted over the years, and I always look forward to learning something new.

Offline pfletch101

  • Senior Contributor
  • ****
  • Posts: 242
    • Personal Website
Re: Displaying forecast on photocopier
« Reply #16 on: April 21, 2018, 04:37:16 PM »
Rather than attempting to write an original article on writing text and graphics to an image file in PHP, I have extensively commented the script file I originally uploaded, explaining what it is doing, step by step. I have zipped and attached the commented script here. I hope that this helps.
Vantage Pro 2+ with WeatherLink - data incorporated in domestic energy production (PV) and use monitoring system.