Convert the HEX string to binary:
$binary = pack("H*", $hex);
pack("H*", ...)
is equivalent to hex2bin
, which is available since PHP 5.4.
Write it to disk:
file_put_contents("file.png", $binary);
More Related Contents:
- Laravel – only a zero is saved to the database
- storing user_id in session variable
- I am seeing this error on submitting form Error: query was empty [closed]
- Reference: What is a perfect code sample using the MySQL extension? [closed]
- Convert from MySQL datetime to another format with PHP
- MySQL vs MySQLi when using PHP [closed]
- How do I set ORDER BY params using prepared PDO statement?
- Call a REST API in PHP
- Passing an array to a query using a WHERE clause
- How can I store and retrieve images from a MySQL database using PHP?
- PHP/MySQL Insert null values
- mysqli_stmt::bind_param(): Number of elements in type definition string doesn’t match number of bind variables
- Mechanisms for tracking DB schema changes [closed]
- Can you add an if statement in ORDER BY?
- Import file size limit in PHPMyAdmin
- PDO Connection Test
- MySQL (or PHP?) group results by field data
- SELECT COUNT() vs mysql_num_rows();
- Store procedures in phpMyAdmin
- Check if a row exists using old mysql_* API
- Unique IPs in a voting system
- MySQL get a random value between two values
- Get MySQL database output via PHP to XML
- php warning mysql_fetch_assoc
- Check if row exists in the database before inserting
- MySQL Table does not exist error, but it does exist
- How do you make good use of multicore CPUs in your PHP/MySQL applications? [closed]
- Unique key generation
- how to execute mysql command DELIMITER
- How to get a list of databases?