You are here

function apps_request_manifest_image_process in Apps 7

Process images and size with images styles.

Process images (logo and screenshots) so that they can be sized with image styles.

Parameters

array $manifest: An app manifest for a server

1 call to apps_request_manifest_image_process()
apps_request_manifest in ./apps.manifest.inc
Request manifest and media assets from the app server.

File

./apps.manifest.inc, line 284
Handles pulling and processing of app data from the server

Code

function apps_request_manifest_image_process(&$manifest) {
  foreach ($manifest['apps'] as $id => &$app) {
    if (isset($app['logo'])) {
      $app['logo'] = apps_retrieve_app_image($id, $app['logo'], t("@name Logo", array(
        '@name' => $app['name'],
      )));
    }
    if (isset($app['screenshots'])) {
      foreach ($app['screenshots'] as $index => $url) {
        $name = isset($app['name']) ? $app['name'] : $manifest['name'];
        $screenshot = apps_retrieve_app_image($id, $url, t("@name Screenshot @index", array(
          '@name' => $name,
          '@index' => $index,
        )));
        if (!empty($screenshot)) {
          $app['screenshots'][$index] = $screenshot;
        }
        else {
          unset($app['screenshots'][$index]);
        }
      }
    }
  }
}