You are here

public function FppTestHelper::generateImage in Fieldable Panels Panes (FPP) 7

Create an image of a specific size & type.

Parameters

string $image_size: The size of the requested image in 'XxY' format; defaults to '200x200'.

string $format: The image format to use; defaults to 'png'.

string $scheme: The storage scheme to use; defaults to 'public'.

Return value

string The URL to a public file.

1 call to FppTestHelper::generateImage()
FppTestHelper::generateImageFile in tests/fpp.helper.test
Create an image file object of a specific size & type.

File

tests/fpp.helper.test, line 86
A base class for the Fieldable Panels Panes tests, provides shared methods.

Class

FppTestHelper
A base class for the Fieldable Panels Panes tests, provides shared methods.

Code

public function generateImage($image_size = '200x200', $format = 'png', $scheme = 'public') {

  // Only proceed if the Devel Generate module is installed.
  if (module_exists('devel_generate')) {

    // Load the Devel Generate image generator logic.
    module_load_include('inc', 'devel_generate', 'image.devel_generate');
    $image_format = 'png';
    $image_size = '200x200';
    $temp_image = devel_generate_image($image_format, $image_size, $image_size);
    return file_unmanaged_move($temp_image, $scheme . '://');
  }
  else {
    $this
      ->error('The Devel Generate module is not enabled, it must be added to the $modules array in the setUp() method for this test class.');
  }
}