Example #1
0
function imagecreatefrom_ico($scr)
{
    $i = new Ico($scr);
    if (!($r = $i->GetIcon())) {
        return false;
    }
    //	$i->debug_this();
    //	exit;
    return $r;
}
Example #2
0
 /**
  * @covers Image\Reader\Adapter\Ico::getImage
  */
 public function testGetImage()
 {
     $image = $this->object->getImage(dirname(__FILE__) . '/../../../image.ico');
     $this->assertTrue($image && 'gd' == get_resource_type($image));
 }
Example #3
0
function ico_png($source, $target, $proxy = '')
{
    $ext = strtolower(substr(strrchr($source, '.'), 1, 10));
    $imgexts = array('png', 'jpg', 'jpeg', 'gif');
    if (in_array($ext, $imgexts)) {
        exit($source);
        $data = dzz_file_get_contents($source, 0, $proxy);
        if ($data && file_put_contents($target, $data)) {
            return true;
        } else {
            return false;
        }
    } elseif ($ext == 'ico') {
        require_once dzz_libfile('class/ico');
        $oico = new Ico($source, $proxy);
        $max = -1;
        $data_length = 0;
        for ($i = 0; $i < $oico->TotalIcons(); $i++) {
            $data = $oico->GetIconInfo($i);
            if ($data['data_length'] > $data_length) {
                $data_length = $data['data_length'];
                $max = $i;
            }
        }
        if ($max >= 0 && imagepng($oico->GetIcon($max), $target)) {
            return true;
        } else {
            return false;
        }
    } else {
        return false;
    }
}