junkk rr junkk rr - 1 year ago 84
PHP Question

How to find image encryption algorithm

How i can decrypt the encrypted image. The image descryption is showing like.

ÿØÿà�JFIF��–�–��ÿþ�.Handmade Software, Inc. Image Alchemy v1.11

#!!!$'$ & ! ÿÀ�àg!�ÿÄ¢����������
%&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyzƒ„…†‡ˆ‰Š’“”•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖ×ØÙÚáâãäåæçèéêñòóôõö÷øùú��w�!1AQaq"2B‘¡±Á #3Rð

This image is coming from the RETS API. I am using the PHRETS Library to get the data. This Library is in the PHP. The function used to get the image data as:

$objects = $rets->GetObject('Property', 'Photo', '61555', '*', 0);
foreach ($objects as $photo) {
$photo = $photo->getContent();
echo "<hr><pre>";
echo "</pre><hr>";

Answer Source

$photo contains raw JPEG image data. You can display it by base64 encoding it and using the base64 encoded string as part of a Data URI that you set as the src of an image:

echo "<img src=\"data:image/jpeg;base64," . base64_encode($photo) . "\" />"; 

This may not be best practise if the images are large. It's better to have a separate PHP script that returns the image based on an id, and then you can reference that script in the src field of the img tag. That way the browser can possibly cache it, and the server transmits less data (base64 encoding increases the size).