imagecreatefrompng

Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Create a new image from file or URL
<?php imagecreatefrompng(string $filename): GdImage|false
<?php         switch (strtolower($mime)) {

            case 'image/png':

            case 'image/x-png':

                $core = @imagecreatefrompng($path);

                break;



            case 'image/jpg':
<?php     {

        $size = Mockery::mock('Intervention\Image\Size', [3, 3]);

        $color = [0,0,0,1];

        $resource = imagecreatefrompng(__DIR__.'/images/tile.png');

        $image = Mockery::mock('Intervention\Image\Image');

        $image->shouldReceive('getSize')->once()->andReturn($size);

        $image->shouldReceive('pickColor')->times(9)->andReturn($color);
<?php     public function testGd()

    {

        $resource = imagecreatefrompng(__DIR__.'/images/tile.png');

        $backups = [

            imagecreatefrompng(__DIR__.'/images/tile.png'),

            imagecreatefrompng(__DIR__.'/images/tile.png')
<?php     {

        $resource = imagecreatefrompng(__DIR__.'/images/tile.png');

        $backups = [

            imagecreatefrompng(__DIR__.'/images/tile.png'),

            imagecreatefrompng(__DIR__.'/images/tile.png')

        ];
<?php         $resource = imagecreatefrompng(__DIR__.'/images/tile.png');

        $backups = [

            imagecreatefrompng(__DIR__.'/images/tile.png'),

            imagecreatefrompng(__DIR__.'/images/tile.png')

        ];



        $image = Mockery::mock('Intervention\Image\Image');
<?php     public function testProcessWebpGdWithUnSupportedPalette()

    {

        if (function_exists('imagewebp')) {

            $core = imagecreatefrompng(__DIR__.'/images/black-friday.png');

            $encoder = new GdEncoder;

            $image = Mockery::mock('\Intervention\Image\Image');

            $image->shouldReceive('getCore')->once()->andReturn($core);
<?php     public function testMakeFromResource()

    {

        $resource = imagecreatefrompng('tests/images/circle.png');

        $img = $this->manager()->make($resource);

        $this->assertInstanceOf('Intervention\Image\Image', $img);

        $this->assertInternalType('resource', $img->getCore());
<?php     public function testInsertResource()

    {

        $resource = imagecreatefrompng('tests/images/tile.png');

        $img = $this->manager()->make('tests/images/trim.png');

        $img->insert($resource);

        $this->assertInstanceOf('Intervention\Image\Image', $img);
<?php     public function testFillImageWithResource()

    {

        $resource = imagecreatefrompng('tests/images/tile.png');

        $img = $this->manager()->make('tests/images/trim.png');

        $img->fill($resource, 0, 0);

        $this->assertColorAtPosition('#b4e000', $img, 0, 0);
<?php         $driver->shouldReceive('init')->with($mask_path)->once()->andReturn($mask_image);



        $image_size = Mockery::mock('Intervention\Image\Size', [32, 32]);

        $image_core = imagecreatefrompng(__DIR__.'/images/trim.png');

        $image = Mockery::mock('Intervention\Image\Image');

        $image->shouldReceive('getSize')->once()->andReturn($image_size);

        $image->shouldReceive('getDriver')->times(2)->andReturn($driver);
<?php         $mask = Mockery::mock('\Intervention\Image\Image');

        $mask->shouldReceive('getCore')->once()->andReturn($mask_core);



        $resource = imagecreatefrompng(__DIR__.'/images/trim.png');

        $driver = Mockery::mock('\Intervention\Image\Gd\Driver');

        $driver->shouldReceive('newImage')->with(32, 32, 'rgba(0, 0, 0, 0.5)')->andReturn($mask);