Quantcast
Channel: PHP- Get file type by URL - Stack Overflow
Browsing latest articles
Browse All 8 View Live

Answer by Jehad Ahmad Jaghoub for PHP- Get file type by URL

the best way for my understanding if (!function_exists('getUrlMimeType')) { function getUrlMimeType($url) { $buffer = file_get_contents($url); $finfo = new finfo(FILEINFO_MIME_TYPE); return...

View Article


Answer by pgee70 for PHP- Get file type by URL

Here is a PHP function I came up with:/** * @param $image_path * @return string|null */function get_image_mime_type(string $image_path):?string{ $mimes = [ IMAGETYPE_GIF => "image/gif",...

View Article

Answer by Gentle153 for PHP- Get file type by URL

You are not going wrong anywhere. exif_imagetype returns the value of one of the image type constants: http://php.net/manual/en/image.constants.phpIf you would like to convert this to an extension...

View Article

Answer by Avis for PHP- Get file type by URL

<?php $image_path="http://fc04.deviantart.net/fs71/f/2010/227/4/6/PNG_Test_by_Destron23.png"; echo exif_imagetype($image_path);?>It returned 3 because png response type as maciej said.Try this to...

View Article

Answer by Maciej Asembler for PHP- Get file type by URL

3 is image type response for PNG image. See:http://php.net/manual/en/function.exif-imagetype.php

View Article


Answer by Grice for PHP- Get file type by URL

exif_imagetype returns the image type. The response, 3, indicates it is IMAGETYPE_PNG, the correct response.

View Article

Answer by Alex Howansky for PHP- Get file type by URL

In the first example, you're getting a blank page because you're not doing anything with the return value from the function call. In the second example, you're getting a valid response. See the manual...

View Article

PHP- Get file type by URL

I want to get the file type (eg. image/gif) by URL using PHP.I had...

View Article

Browsing latest articles
Browse All 8 View Live




<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>