Author Topic: Multifunction image handler php script with https  (Read 530 times)

0 Members and 1 Guest are viewing this topic.

Offline i_fiorentino

  • Forecaster
  • *****
  • Posts: 562
  • Davis Vantage Vue, Boltek Stormtr., Mobotix M22-IT
    • Meteopistoia.it
Multifunction image handler php script with https
« on: September 18, 2021, 04:47:28 AM »
Unfortunately when i switched to https protocoll the script doesn't work anymore.

Does anyone know how to make this script working with https protocoll?
Or, if possible, tell me another script with the same functionalities.
Thanks in advance for any help.
Mike stopped support of this project since 2014 :(

Regards,


Alessandro

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1855
    • My PWS at Leuven Belgium Europe
Re: Multifunction image handler php script with https
« Reply #1 on: September 18, 2021, 05:43:04 AM »
Unfortunately when i switched to https protocoll the script doesn't work anymore.

Does anyone know how to make this script working with https protocoll?
Or, if possible, tell me another script with the same functionalities.
Thanks in advance for any help.
Mike stopped support of this project since 2014 :(
Regards,
Alessandro

I found no problems with this script, similar code was used in the past for the space-weather script to cache images.
I tested with Version: 1.99.4  26-Apr-2014  using
=> PHP 8.0.7,
=> on a https website,
=> with the unchanged script
=> fresh download https://www.642weather.com/weather/scripts/multifunction-image-handler.php?sce=view
=> using the default image and one other image
=> both images are on a https website.
Code: [Select]
$ImageURL = 'https://www.642weather.com/weather/webcamimage.jpg';
$ImageURL = 'https://admin.meteobridge.com/cam/f900b6e9aaab99089f17dd823487fc98/camplus.jpg';

Both tests work correct, a correct resized image was shown,  and the temp and cached version were created and used also.

The script uses curl to fetch the image and https support should therefor be no problem.
Line 138 should start with https  if the image should be loaded from a https website.

Can you
=> explain what the problem is?
=> and post the url of the script you are using?

Wim
« Last Edit: September 18, 2021, 05:56:32 AM by wvdkuil »
Support for Leuven-Template & Scripts  at this forum via https://support.leuven-template.eu/
Support for the PWS_Dashboard  pwsdashboard.com

Offline i_fiorentino

  • Forecaster
  • *****
  • Posts: 562
  • Davis Vantage Vue, Boltek Stormtr., Mobotix M22-IT
    • Meteopistoia.it
Re: Multifunction image handler php script with https
« Reply #2 on: September 18, 2021, 06:54:00 AM »
Thanks for reply Wim.

My script is here: https://meteopistoia.it/pistoia-webcam.php
A copy of my settings are attached.

Simply the script doesn't catch a fresh image anymore.

Thanks in advance.
Regards,

Alessandro

Offline wvdkuil

  • Wim van der kuil
  • Forecaster
  • *****
  • Posts: 1855
    • My PWS at Leuven Belgium Europe
Re: Multifunction image handler php script problem loading image
« Reply #3 on: September 18, 2021, 08:04:25 AM »
Thanks for reply Wim.

My script is here: https://meteopistoia.it/pistoia-webcam.php
A copy of my settings are attached.

Simply the script doesn't catch a fresh image anymore.

Thanks in advance.
Regards,

Alessandro
Problem:
There has been more changes to the web-server when you changed to https.
The used link  https://meteopistoia.it/webcam/pistoia.jpg  always displays the same file in the browser also.
The first time the image is loaded it gets a valid max-age=2592000  which is 3 days.

So we have to adjust the link to the image on line 138 from
Code: [Select]
$ImageURL = 'https://meteopistoia.it/webcam/pistoia.jpg'; to
Code: [Select]
$ImageURL = 'https://meteopistoia.it/webcam/pistoia.jpg?t='.time(); That makes sure that the webserver will not find the image and serves the latest one.

There are some other errors which show as you removed the comment marks om lines 129-130
Code: [Select]
Warning: imagettfbbox():
Could not find/open font in /var/www/vhosts/meteopistoia.it/public_html/pistoia-webcam.php on line 910
You are using ttf fonts but read what line 346 warns for
Code: [Select]
# DO NOT USE UNLESS YOU HAVE arial.ttf file in the same directory as this script!If you want to use a ttf font, copy an arial.ttf font to the same directory where also the script is located.

Set lines 129 - 130 to comment to get rid of the messages every time a new webcam image is loaded.
Code: [Select]
// error_reporting(E_ALL); // Report all errors and warnings (very strict, use for testing only)
// ini_set('display_errors', 1); // turn error reporting on

Succes, Wim
« Last Edit: September 18, 2021, 08:19:05 AM by wvdkuil »
Support for Leuven-Template & Scripts  at this forum via https://support.leuven-template.eu/
Support for the PWS_Dashboard  pwsdashboard.com

Offline i_fiorentino

  • Forecaster
  • *****
  • Posts: 562
  • Davis Vantage Vue, Boltek Stormtr., Mobotix M22-IT
    • Meteopistoia.it
Re: Multifunction image handler php script with https
« Reply #4 on: September 18, 2021, 09:06:24 AM »
Many many thanks Wim  [tup] [tup],
now it works perfectly here: https://meteopistoia.it/pistoia-webcam.php

 =D> =D> =D>

King regards,


Alessandro