在PHP中使用Mozilla Open Badges .png图像创建

时间:2016-12-15 16:03:33

标签: php png mozilla openbadge

我需要使用PHP中嵌入的Open Badges断言元数据创建一个.png图像。

我环顾四周,我只看到了一些Mozilla API端点,但我需要在自己的服务器上创建该文件。

有没有办法手工完成,还是我应该依赖外部服务?

1 个答案:

答案 0 :(得分:3)

您可以使用PHP库Imagick手动将元数据添加到.png文件中。

请检查此自定义小型库如何使用它: https://github.com/jmunozdev/php-tiny-openbadges-image-baker

$im = new Imagick($image_url);
// Set the image properties.
$im->setimageproperty('openbadges', $this->assertionJsonUrl);
// Return the final baked blob of the imagefile.
return base64_encode($im->getimageblob());

正在使用Imagick库创建嵌入了数据的donwloadable .png文件,同时也为Drupal 7提供了一种方法。我使用它并且工作得很好,你可以在这里检查你的徽章图像的完整性:{ {3}}

希望它有所帮助。

相关问题