News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Images not showing when posted from ios14

Started by russwalling, November 24, 2020, 12:14:54 PM

Previous topic - Next topic

russwalling

Users attaching images from apple ios 14 that are .webp are not visible in the post.  It shows the attachment is available for download, but there is no embedded image like with jpg or png etc.

They are telling me all their pics are converted to this format as a default as they are stored on their camera roll in photos.

Any ideas on a fix?  I'm not that savvy to start with, so a Disney version would be great!
Thanks!!

Kindred

#1
currently, SMF does not detect/display webp images as images.

it would require a code update to change this.
I do not believe that the future 2.0.18 release addresses this either.



have not tried this.  BACKUP BACKUP BACKUP

possibly, this may address it
Code (find this code in Sources/Display.php) Select

// Does this have a mime type?
elseif (!empty($mime_type) && (isset($_REQUEST['image']) || !in_array($file_ext, array('jpg', 'gif', 'jpeg', 'x-ms-bmp', 'png', 'psd', 'tiff', 'iff'))))
header('Content-Type: ' . strtr($mime_type, array('image/bmp' => 'image/x-ms-bmp')));


Code (change it to) Select

// Does this have a mime type?
elseif (!empty($mime_type) && (isset($_REQUEST['image']) || !in_array($file_ext, array('jpg', 'gif', 'jpeg', 'x-ms-bmp', 'png', 'psd', 'tiff', 'iff'. 'webp'))))
header('Content-Type: ' . strtr($mime_type, array('image/bmp' => 'image/x-ms-bmp')));


Code (and also find this code in Sources/Display.php) Select

// If this has an "image extension" - but isn't actually an image - then ensure it isn't cached cause of silly IE.
if (!isset($_REQUEST['image']) && in_array($file_ext, array('gif', 'jpg', 'bmp', 'png', 'jpeg', 'tiff')))
header('Cache-Control: no-cache');
else
header('Cache-Control: max-age=' . (525600 * 60) . ', private');



Code (change it to) Select

// If this has an "image extension" - but isn't actually an image - then ensure it isn't cached cause of silly IE.
if (!isset($_REQUEST['image']) && in_array($file_ext, array('gif', 'jpg', 'bmp', 'png', 'jpeg', 'tiff', 'webp')))
header('Cache-Control: no-cache');
else
header('Cache-Control: max-age=' . (525600 * 60) . ', private');



also, include webp as one of the allowed extensions in your SMF admin
/index.php?action=admin;area=manageattachments;sa=attachments
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

russwalling

Thanks a bunch for the quick reply!  I'll check it out

Advertisement: