douweng3564 2014-11-08 07:44
浏览 33
已采纳

PHP Alter Base64图像编码

I am developing an application and for that I need to generate multiple copies of same image with unique base 64 encoding.

However I am not sure that if I add a random string like "aasasa" in between my image code whether it will corrupt image or it will display properly?

Is there any way to achieve this?

    $imageDataEncoded = base64_encode(file_get_contents($_FILES["fileToUpload"]["tmp_name"]));

     $imageData = base64_decode($imageDataEncoded);
     $imageData="asasasas".$imageData;
     $source = imagecreatefromstring($imageData);

Thanks Ahmar

  • 写回答

1条回答 默认 最新

  • duankanjian4642 2014-11-08 08:00
    关注

    It's not entirely obvious why you would want to do this (maybe there is a better way to achieve what you're after). Anyways, I would try and change the image metadata. By changing the metadata you are "not changing" the image itself.

    Further reading material:

    http://php.net/manual/en/book.exif.php

    http://php.net/manual/en/function.iptcembed.php

    http://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html

    This can be achieved by using a EXIF library, but be aware that these changes are obviously way more performance intensive and can slow down your load time significantly, especially if you do this on a lot of pages.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 对于这个问题的解释说明
  • ¥200 询问:python实现大地主题正反算的程序设计,有偿
  • ¥15 smptlib使用465端口发送邮件失败
  • ¥200 总是报错,能帮助用python实现程序实现高斯正反算吗?有偿
  • ¥15 对于squad数据集的基于bert模型的微调
  • ¥15 为什么我运行这个网络会出现以下报错?CRNN神经网络
  • ¥20 steam下载游戏占用内存
  • ¥15 CST保存项目时失败
  • ¥15 树莓派5怎么用camera module 3啊
  • ¥20 java在应用程序里获取不到扬声器设备