Познаване на снимка

dakata__92

Super Moderator
Колеги, как да разбера типът на дадено изображение ако се намира на урл http://example.com/image.php . Дали е png, jpeg или gif? :?:
 
Хмм... google it? :)

http://stackoverflow.com/questions/12656889/php-get-remote-file-mime-type
stackoverflow.com каза:
PHP:
<?php
    # the request
    $ch = curl_init('http://www.google.com');
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_exec($ch);

    # get the content type
    echo curl_getinfo($ch, CURLINFO_CONTENT_TYPE);

    # output
    // text/html; charset=ISO-8859-1
?>
 
dakata__92 каза:
http://bg2.php.net/manual/bg/function.exif-imagetype.php

Това мисля, че е решението на въпросът ми!
Хехе тъкмо това гледах :Д
но някой пише
exif isnt installed :(
и затва не го постнах тук.

Виж и това:
http://stackoverflow.com/a/3931959/3132718

А може и така:
PHP:
$props = getimagesize("http://www.example.com/gifs/logo.gif");
$type = $props['mime'];
 

Back
Горе