I wanted to try to convert an image to Binary.
I found a script online but it does not work.
Could someone please advise why?
<?php
$image="image003.jpg";
$data = fopen ($image, 'rb');
$size=filesize ($image);
$contents= fread ($fd, $size);
fclose ($fd);
$encoded= base64_encode($contents);
echo $encoded;
?>
I have an error come up on line 8 and 9
Warning: fread() expects parameter 1 to be resource
and
Warning: fclose() expects parameter 1 to be resource,
$fdisn't defined here. Please show the code where$fdis defined.