Annotation of embedaddon/php/ext/gd/tests/imagecolorstotal_basic.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test imagecolorstotal() function : basic functionality
! 3: --SKIPIF--
! 4: <?php
! 5: if(!extension_loaded('gd')) {
! 6: die('skip gd extension is not loaded');
! 7: }
! 8:
! 9: if(!function_exists('imagecolorstotal') || !function_exists('imagecreatefromgif')) {
! 10: die('skip imagecolorstotal and imagecreatefromgif functions not available in this build');
! 11: }
! 12: ?>
! 13: --FILE--
! 14: <?php
! 15: /* Prototype : int imagecolorstotal ( resource $image )
! 16: * Description: Find out the number of colors in an image's palette
! 17: * Source code: ext/gd/gd.c
! 18: */
! 19:
! 20: echo "*** Testing imagecolorstotal() : basic functionality ***\n";
! 21:
! 22: // Get an image
! 23: $gif = dirname(__FILE__)."/php.gif";
! 24: $im = imagecreatefromgif($gif);
! 25:
! 26: echo 'Total colors in image: ' . imagecolorstotal($im);
! 27:
! 28: // Free image
! 29: imagedestroy($im);
! 30: ?>
! 31:
! 32: ===DONE===
! 33: --EXPECTF--
! 34: *** Testing imagecolorstotal() : basic functionality ***
! 35: Total colors in image: 128
! 36: ===DONE===
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>