Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Create a new image from file or URL
<?php imagecreatefromjpeg(string $filename): GdImage|false
<?php case 'image/jpg':
case 'image/jpeg':
case 'image/pjpeg':
$core = @imagecreatefromjpeg($path);
if (!$core) {
$core= @imagecreatefromstring(file_get_contents($path));
}
<?php public function testIsGdResource()
{
$resource = imagecreatefromjpeg(__DIR__.'/images/test.jpg');
$source = $this->getTestDecoder($resource);
$this->assertTrue($source->isGdResource());
<?php {
$driver = Mockery::mock('Intervention\Image\Gd\Driver');
$driver->shouldReceive('cloneCore')->once();
$resource = imagecreatefromjpeg(__DIR__.'/images/test.jpg');
$image = Mockery::mock('Intervention\Image\Image', [$driver]);
$image->shouldReceive('getCore')->once()->andReturn($resource);
$image->shouldReceive('setBackup')->once();
<?php {
$driver = Mockery::mock('Intervention\Image\Gd\Driver');
$driver->shouldReceive('cloneCore')->once();
$resource = imagecreatefromjpeg(__DIR__.'/images/test.jpg');
$image = Mockery::mock('Intervention\Image\Image', [$driver]);
$image->shouldReceive('getCore')->once()->andReturn($resource);
$image->shouldReceive('setBackup')->once();
<?php public function testGd()
{
$resource = imagecreatefromjpeg(__DIR__.'/images/test.jpg');
$image = Mockery::mock('Intervention\Image\Image');
$image->shouldReceive('getCore')->times(2)->andReturn($resource);
$command = new BlurGd([2]);
<?php public function testGd()
{
$resource = imagecreatefromjpeg(__DIR__.'/images/test.jpg');
$image = Mockery::mock('Intervention\Image\Image');
$image->shouldReceive('getCore')->once()->andReturn($resource);
$command = new BrightnessGd([12]);
<?php public function testGd()
{
$resource = imagecreatefromjpeg(__DIR__.'/images/test.jpg');
$driver = Mockery::mock('\Intervention\Image\Gd\Driver');
$driver->shouldReceive('getDriverName')->once()->andReturn('Gd');
$image = Mockery::mock('\Intervention\Image\Image');
<?php public function testGd()
{
$resource = imagecreatefromjpeg(__DIR__.'/images/test.jpg');
$image = Mockery::mock('Intervention\Image\Image');
$image->shouldReceive('getCore')->once()->andReturn($resource);
$command = new ColorizeGd([20, 0, -40]);
<?php public function testGd()
{
$resource = imagecreatefromjpeg(__DIR__.'/images/test.jpg');
$image = Mockery::mock('Intervention\Image\Image');
$image->shouldReceive('getCore')->once()->andReturn($resource);
$command = new ContrastGd([20]);
<?php public function testGd()
{
$resource = imagecreatefromjpeg(__DIR__.'/images/test.jpg');
$image = Mockery::mock('Intervention\Image\Image');
$image->shouldReceive('getCore')->once()->andReturn($resource);
$image->shouldReceive('setCore')->once();
<?php public function testGd()
{
$resource = imagecreatefromjpeg(__DIR__.'/images/test.jpg');
$driver = Mockery::mock('\Intervention\Image\Gd\Driver');
$driver->shouldReceive('getDriverName')->once()->andReturn('Gd');
$image = Mockery::mock('\Intervention\Image\Image');
<?php public function testProcessJpegGd()
{
$core = imagecreatefromjpeg(__DIR__.'/images/test.jpg');
$encoder = new GdEncoder;
$image = Mockery::mock('\Intervention\Image\Image');
$image->shouldReceive('getCore')->once()->andReturn($core);
<?php public function testProcessPngGd()
{
$core = imagecreatefromjpeg(__DIR__.'/images/test.jpg');
$encoder = new GdEncoder;
$image = Mockery::mock('\Intervention\Image\Image');
$image->shouldReceive('getCore')->once()->andReturn($core);
<?php public function testProcessGifGd()
{
$core = imagecreatefromjpeg(__DIR__.'/images/test.jpg');
$encoder = new GdEncoder;
$image = Mockery::mock('\Intervention\Image\Image');
$image->shouldReceive('getCore')->once()->andReturn($core);
<?php public function testProcessWebpGd()
{
if (function_exists('imagewebp')) {
$core = imagecreatefromjpeg(__DIR__.'/images/test.jpg');
$encoder = new GdEncoder;
$image = Mockery::mock('\Intervention\Image\Image');
$image->shouldReceive('getCore')->once()->andReturn($core);