Why is mime_content_type() deprecated in PHP?
I guess it's because Fileinfo can return more information about files.
EDIT: Here is a replacement hack:
function _mime_content_type($filename) {
$result = new finfo();
if (is_resource($result) === true) {
return $result->file($filename, FILEINFO_MIME_TYPE);
}
return false;
}
PHP: where is the mime_content_type function?
mime_content_type
is not deprecated. It was apparently just a mistake in the documentation.
See this bug report
mime_content_type() support in php
The mime_content_type error is due to it not being available in your PHP build (it has been deprecated for some time now). But you could create that function yourself: http://php.net/mime_content_type
If you are using the latest version of the class, you can also override the mime type by passing 'Content-Type' => 'your-mime-type' to putObject()'s $requestHeaders. See: https://github.com/tpyo/amazon-s3-php-class#uploading-objects
There is an update in the works to allow custom mime lookup callbacks too.
mime_content_type(): Invalid path
mime_content_type requires path to the tested file, not just base64 string. But why are you trying to recognize mime type when you know it is image/jpeg (by imagejpeg function).
$src = "data:image/jpeg;base64," . $imageData;
Related Topics
Why Is Crontab Not Executing My PHP Script
Laravel - Using (:Any) Wildcard for All Routes
Namespace in PHP Codeigniter Framework
How to Pass an Array via $_Get in PHP
Magic _Get Getter for Static Properties in PHP
PHP Daylight Saving Time Detection
Is Is Possible to Set a Default Pdo Fetch Mode
Ajax Post Request in Laravel 5 Return Error 500 (Internal Server Error)
How to Set Utf-8 Encoding for a PHP File
_Construct() VS Sameasclassname() for Constructor in PHP
Send PHP HTML Mail with Attachments
Can You Re-Populate File Inputs After Failed Form Submission with PHP or JavaScript
Laravel 5.4 Redirection to Custom Url After Login
Get Orders Total Purchases Amount for the Day in Woocommerce