|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2006-08-20 19:54 UTC] pajoye@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 11:00:01 2025 UTC |
Description: ------------ I use imagecreatefromstring to load a binary stream, which is probably a jpeg image (thumbnail). With imagesx and imagesy I can retrieve the width and height of the resource, but I cannot retrieve the imagetype or mimetype of the resource. As described in the imagecreatefromstring function documentation, the imagetype will be automatically detected if the build of PHP can support it. Maybe an imagestype function can retrieve the imagetype from an image resource? Reproduce code: --------------- <?php $data = 'iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABl' . 'BMVEUAAAD///+l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDr' . 'EX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r' . '8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg=='; $data = base64_decode($data); $im = imagecreatefromstring($data); echo "width: ".imagesx ($im)."\n"; echo "height: ".imagesy ($im)."\n"; echo "type: ".imagestype ($im)."\n"; ?> Expected result: ---------------- width: 28 height: 28 type: 3 Actual result: -------------- width: 28 height: 18 PHP Fatal error: Call to undefined function imagestype() in %location%\- on line 11 Fatal error: Call to undefined function imagestype() in %location%\- on line 11