You are here

function _pwa_apple_get_spalsh_screen_href in Progressive Web App 7.2

1 call to _pwa_apple_get_spalsh_screen_href()
_pwa_apple_splash_screens_meta in includes/pwa.apple.inc

File

includes/pwa.apple.inc, line 82

Code

function _pwa_apple_get_spalsh_screen_href($data) {
  $base_folder = 'public://pwa/apple';
  $directory = _pwa_apple_create_folder($base_folder);
  if (!file_exists($directory . '/drusplash.png')) {
    _pwa_apple_create_image_base();
  }
  $base_image = $base_folder . '/drusplash.png';
  $image_path = $base_folder . '/' . pathinfo($base_image, PATHINFO_FILENAME) . '-' . $data['width'] . 'x' . $data['height'] . '.' . pathinfo($base_image, PATHINFO_EXTENSION);
  if (file_exists($image_path)) {
    return file_create_url($image_path);
  }
  if (!($image = image_load($base_image))) {
    return FALSE;
  }

  // Get the folder for the final location of this style.
  // Build the destination folder tree if it doesn't already exist.
  module_load_include('inc', 'image', 'image.effects');
  image_scale_and_crop_effect($image, $data);
  if (!image_save($image, $image_path)) {
    return FALSE;
  }
  return file_create_url($image_path);
}