php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #65037 Make identifyImage() return the mimetype.
Submitted: 2013-06-14 00:52 UTC Modified: 2013-09-25 07:49 UTC
From: F21 dot groups at gmail dot com Assigned: mkoppanen (profile)
Status: Closed Package: imagick (PECL)
PHP Version: 5.4.16 OS: Ubuntu 12.10
Private report: No CVE-ID: None
 [2013-06-14 00:52 UTC] F21 dot groups at gmail dot com
Description:
------------
It would be nice if identifyImage() can return the mime type.

Currently, it does not do that, so, I need to save the image to a temporary place and run getimagesize() on it, which is part of GD.

Test script:
---------------
<?php 
$img = new Imagick('https://www.google.com.au/images/srpr/logo4w.png');
var_dump($img->identifyImage());

Expected result:
----------------
array (size=7)
  'format' => string 'PNG (Portable Network Graphics)' (length=31)
  'geometry' => 
    array (size=2)
      'width' => int 550
      'height' => int 190
  'units' => string 'Undefined' (length=9)
  'type' => string 'Palette' (length=7)
  'colorSpace' => string 'sRGB' (length=4)
  'compression' => string 'Zip' (length=3)
  'fileSize' => string '18.9KB' (length=6)
  'mimeType' => 'image/png'

Actual result:
--------------
array (size=7)
  'format' => string 'PNG (Portable Network Graphics)' (length=31)
  'geometry' => 
    array (size=2)
      'width' => int 550
      'height' => int 190
  'units' => string 'Undefined' (length=9)
  'type' => string 'Palette' (length=7)
  'colorSpace' => string 'sRGB' (length=4)
  'compression' => string 'Zip' (length=3)
  'fileSize' => string '18.9KB' (length=6)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-09-25 07:49 UTC] mkoppanen@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: mkoppanen
 [2013-09-25 07:49 UTC] mkoppanen@php.net
Thank you for your bug report. This issue has already been fixed
in the latest released version of PHP, which you can download at 
http://www.php.net/downloads.php

3.1.2
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 15 15:01:36 2024 UTC