Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
zoic21 authored Jul 30, 2024
1 parent 4a57cd7 commit 034e92d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions core/class/z2m.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -788,9 +788,12 @@ public function getImgFilePath() {
if (file_exists($filename)) {
unlink($filename);
}
file_put_contents($filename, file_get_contents('https://www.zigbee2mqtt.io/images/devices/' . $model . '.jpg', 0, stream_context_create(["http"=>["timeout"=>2]])));
file_put_contents($filename, file_get_contents('https://www.zigbee2mqtt.io/images/devices/' . $model . '.png', 0, stream_context_create(["http"=>["timeout"=>2]])));
if(filesize($filename) < 2){
file_put_contents($filename, file_get_contents('https://www.zigbee2mqtt.io/images/devices/' . $model . '.png', 0, stream_context_create(["http"=>["timeout"=>2]])));
if (file_exists($filename)) {
unlink($filename);
}
file_put_contents($filename, file_get_contents('https://www.zigbee2mqtt.io/images/devices/' . $model . '.jpg', 0, stream_context_create(["http"=>["timeout"=>2]])));
}
}
if (!file_exists($filename) || filesize($filename) < 2) {
Expand Down

0 comments on commit 034e92d

Please sign in to comment.