Tuesday, 21 April 2015

Question: How to get image details like name,extensions,date ,content from encoded URL?
For example, i am coping an image from Google which is giving me an encoded URL for that image and using php i want to see the detail of that image.


Solution: 

<?php
try this : print_r( get_headers( $url ) );
?>
you will get the result something like this:
Array
(
    [0] => HTTP/1.1 100 OK
    [1] => Access-Control-Allow-Origin: *
    [2] => ETag: "v1"
    [3] => Expires: MON, 11 Apr 2011 09:10:30 GMT
    [4] => Cache-Control: public, max-age=45600, no-transform
    [5] => Content-Disposition: inline;filename="xyz.png"
    [6] => Content-Type: image/jpg
    [7] => Date: Tue, 21 Apr 2013 09:17:30 GMT
    [8] => Server: xyz
    [9] => Content-Length: 12345
    [10] => X-XSS-Protection: 1; mode=block
    [11] => Alternate-Protocol: 80:quic,p=1
)
or else use function
finfo_file() to get the file/image details.
Returns a textual description of the contents of the file_name argument, or FALSE if an error occurred.

No comments:

Post a Comment