I am storing my image as BLOB in an online MySQL database by encoding the image using Base64. I don't have a problem with saving. But I can't retrieve the images from the server. They appear to be broken. I believe this is happening because it's not being decoded.
I tried manually uploading a couple of photos to the server, and they are retrieved properly since they are not encoded. This is the code I'm using to retrieve the image. Can someone please tell me how to decode the image?
<?php$db = mysql_connect("localhost","un","pw") or die(mysql_error()); mysql_select_db("datab",$db) or die(mysql_error()); $userId = $_GET['eid']; $query = "SELECT image FROM event WHERE eid='$userId'"; $result = mysql_query($query) or die(mysql_error()); $photo = mysql_fetch_array($result); header('Content-Type:image/png;base64'); echo $photo['image']; ?>
I can't find an answer to this. If I encode a string with Base64 will the encoded output be unique based on the string? I ask because I want to create a token which will contain user information so I need make sure the output will be unique depending on the information.
For example if I encode "UnqUserId:987654321 Timestamp:01/02/03" will this be unique so no matter what other userid I put it in there will never be a collision?
I have to encode an array of bytes to a base64 string (and decode this string) on an old Delphi 2007.How could I do?
I've tried synapse (As suggested here Binary to Base64 (Delphi)).
I saw a url as the one above.
what is it called ?
how do i encrypt a url to be like that ?