function devel_image_provider_get_file in Devel images provider 7
Same name and namespace in other branches
- 8 devel_image_provider.module \devel_image_provider_get_file()
Return file of $url using selected get_method
9 calls to devel_image_provider_get_file()
- BaseProvider::generateImage in plugins/
devel_image_provider/ provider/ BaseProvider.class.php - Image generation handler.
- DummyImageProvider::generateImage in plugins/
devel_image_provider/ provider/ DummyImageProvider.class.php - Image generation handler.
- FlickholdrProvider::generateImage in plugins/
devel_image_provider/ provider/ FlickholdrProvider.class.php - Image generation handler.
- LorempixumProvider::generateImage in plugins/
devel_image_provider/ provider/ LorempixumProvider.class.php - Image generation handler.
- PlaceamanateeProvider::generateImage in plugins/
devel_image_provider/ provider/ PlaceamanateeProvider.class.php - Image generation handler.
File
- ./
devel_image_provider.module, line 146 - Module file that exposes the options to select an external image provider to generate images.
Code
function devel_image_provider_get_file($url, $filename, $method = 'curl') {
$data = NULL;
switch ($method) {
case 'curl':
$data = devel_image_provider_file_get_data_curl($url);
file_put_contents($filename, $data);
break;
case 'gd':
$image = imagecreatefromjpeg($url);
imagejpeg($image, $filename);
imagedestroy($image);
break;
case 'file_get_contents':
$data = file_get_contents($url);
file_put_contents($filename, $data);
break;
}
return $filename;
}