Browse Source

Fix image/thumbhash base64 URI

feature/templater
Timothée Jaussoin 3 months ago
parent
commit
51af6a0ce5
  1. 4
      app/Message.php
  2. 2
      src/Moxl/Stanza/Message.php

4
app/Message.php

@ -575,11 +575,11 @@ class Message extends Model
$messageFile->thumbnail_url = (string)$thumbnailAttributes->uri;
}
if (substr((string)$thumbnailAttributes->uri, 0, 21) == 'data:image/thumbhash,') {
if (substr((string)$thumbnailAttributes->uri, 0, 28) == 'data:image/thumbhash;base64,') {
$messageFile->thumbnail_width = (int)$thumbnailAttributes->width;
$messageFile->thumbnail_height = (int)$thumbnailAttributes->height;
$messageFile->thumbnail_type = (string)$thumbnailAttributes->{'media-type'};
$messageFile->thumbnail_url = substr((string)$thumbnailAttributes->uri, 21);
$messageFile->thumbnail_url = substr((string)$thumbnailAttributes->uri, 28);
}
}

2
src/Moxl/Stanza/Message.php

@ -210,7 +210,7 @@ class Message
$thumbnail->setAttribute('media-type', $file->thumbnail_type);
if ($file->thumbnail_type == 'image/thumbhash') {
$thumbnail->setAttribute('uri', 'data:image/thumbhash,' . $file->thumbnail_url);
$thumbnail->setAttribute('uri', 'data:image/thumbhash;base64,' . $file->thumbnail_url);
} else {
$thumbnail->setAttribute('uri', $file->thumbnail_url);
}

Loading…
Cancel
Save