如何从所有字符集中读取和显示Exif ImagedEscription

发布于 2025-02-08 11:17:46 字数 577 浏览 2 评论 0原文

以前有一些关于阅读和显示Exif ImageDescription的讨论,几天前我开始这个任务时发布了一个类似的问题。

无论字符集如何,此在线服务都会读取并显示精确的“图像描述”。

https://exifdata.com/

  • 所以我知道这是可能的。我真的希望他们解释如何做到这一点。

尽管阅读了几个小时的解决方案,并在许多网站上进行了帮助,但我尝试了30多种不同的建议,但无法让PHP在此图像的图像描述中显示挪威Ø。

http://www.garryjones.se/testit/1.jpg

而不是发布250行我编码30多次尝试,这看起来一团糟,我希望有人知道答案。几条简单的代码行确实应该是可能的。

任何帮助真的很大,谦卑地得到了。

There are some previous discussions on reading and displaying EXIF ImageDescription and I posted a similar question a few days ago when I began this quest.

This online service reads and displays the exact "Image Description" regardless of character set.

https://exifdata.com/

  • So I know it IS possible. I just really wish they explained how they do it.

Despite reading through hours and hours of solutions and help documents on a multitude of sites I have tried over 30 different suggestions but can not get PHP to display the Norwegian ø in the Image Description of this image.

http://www.garryjones.se/testit/1.jpg

Rather than posting 250 rows of my coding for over 30 attempts which looks a mess I am hoping someone knows the answer. It really should be possible with a couple of simple lines of code.

Any help really greatly and humbly received.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

〃温暖了心ぐ 2025-02-15 11:17:46

我写小型代码片段。我添加了一个扩展程序已启用验证。您可以尝试

<?php
if (function_exists('exif_read_data')):
try {
    $exif = exif_read_data('');
    foreach ($exif as $property => $value):
        echo "<p>{$property}: ";
        if (is_array($value)) :
            echo "( ";
            foreach ($value as $attribute => $item) {
                echo "{$attribute}:{$item}, ";
            }
            echo " )";
        else :
            echo $value;
        endif;

        echo "</p>";

    endforeach;
} catch (\Exception $exception) {
    throw new \Exception($exception->getMessage());
}
else :
    throw new \Exception("EXIF extension is not enabled.");
endif;
?>

进一步了解php文档 https:https:// wwwww .php.net/manual/en/function.exif-read-data.php

I write small code Snippets. I have added an extension is enabled verification. You can try

<?php
if (function_exists('exif_read_data')):
try {
    $exif = exif_read_data('');
    foreach ($exif as $property => $value):
        echo "<p>{$property}: ";
        if (is_array($value)) :
            echo "( ";
            foreach ($value as $attribute => $item) {
                echo "{$attribute}:{$item}, ";
            }
            echo " )";
        else :
            echo $value;
        endif;

        echo "</p>";

    endforeach;
} catch (\Exception $exception) {
    throw new \Exception($exception->getMessage());
}
else :
    throw new \Exception("EXIF extension is not enabled.");
endif;
?>

To know further follow PHP documentation https://www.php.net/manual/en/function.exif-read-data.php

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文