我有一个我们的LDAP数据库的转储,我正在尝试使用PHP从中提取所有图像。图像似乎以JFIF格式存储(至少根据http://tools.ietf.org/html/rfc2798#page-5)。但是,我无法弄清楚如何从中创建JPEG文件;我尝试file_put_contents
将name.jpeg中的所有内容,imagecreatefromstring
的输出转储到imagejpeg
以及其中的一些变体。但是,要么我没有正确使用它们,要么我只是一共尝试这个错误。
所以问题是:
以下是该领域的一小部分:
jpegPhoto:: /9j/4AAQSkZJRgABAQAAAQABAAD//gA+Q1JFQVRPUjogZ2QtanBlZyB2Mi4wICh1c2lu
ZyBJSkcgSlBFRyB2NjIpLCBkZWZhdWx0IHF1YWxpdHkK/9sAQwAIBgYHBgUIBwcHCQkICgwUDQwLCww
ZEhMPFB0aHx4dGhwcICQuJyAiLCMcHCg3KSwwMTQ0NB8nOT04MjwuMzQy/9sAQwEJCQkMCwwYDQ0YMi
EcITIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIy/8AAEQgAh
QBkAwEiAAIRAQMRAf/EAB8AAAEFAQEBAQEBAAAAAAAAAAABAgMEBQYHCAkKC//EALUQAAIBAwMCBAMF
BQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU
2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpq
eoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+v/EAB8BAAMBA
QEBAQEBAQEAAAAAAAABAgMEBQYHCAkKC//EALURAAIBAgQEAwQHBQQEAAECdwABAgMRBAUhMQYSQVEH
YXETIjKBCBRCkaGxwQkjM1LwFWJy0QoWJDThJfEXGBkaJicoKSo1Njc4OTpDREVGR0hJSlNUVVZXWFl
aY2RlZmdoaWpzdHV2d3h5eoKDhIWGh4iJipKTlJWWl5iZm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3WNpIvuA9DyQP64/Ckx5ZEajhRkn1NaEW1kaPsFweM0+VGRnO8j
wHzMkE8exzzUDFnQDJwoxirEdu8khhX53LHAAJJ96j8s4CnJIyMA1mrICuOFHT3opxG04oqjVbDRgdV
981AQ3r+tdRFBpkvEbJvcHLtFj8ODx+h96py6XaxzMSxIJJVVGDt/GslWj1MuYxNgK/Lk+uO1SRxnpn
rVu509Y2LwsXjxyW6g+lRABPvAYxg8VrFqWqGnchI5xmtTQtXuND1SK8t8krwy5IDDuOKp4VyBjB5pg
G0k4PB/CqsNOx7R4YUeLNJv9e8UXvlaNGzRiM7CsS9sZUnf8wAIw313AV5jqMNsNRmeyaQ2YlYwmXG8
Jn5d2OM46471r3vjyXUPDOmaAluLOztV2zeQ2RORjDFcDnO4nnljmsZxtLPC++MHrj8siqSE3cznbZM
答案 0 :(得分:1)
数据是base64编码的,首先对其进行解码,然后将其保存到文件中。见http://www.php.net/manual/en/function.base64-decode.php