You are here

function ad_image_load_image in Advertisement 5.2

Same name and namespace in other branches
  1. 5 image/ad_image.module \ad_image_load_image()
  2. 6.3 image/ad_image.module \ad_image_load_image()
  3. 6 image/ad_image.module \ad_image_load_image()
  4. 6.2 image/ad_image.module \ad_image_load_image()
  5. 7 image/ad_image.module \ad_image_load_image()
1 call to ad_image_load_image()
ad_image_adapi in image/ad_image.module
Adapi implementation.

File

image/ad_image.module, line 328
Enhances the ad module to support banner ads.

Code

function ad_image_load_image($node) {
  if (is_array($node->files)) {
    foreach ($node->files as $file) {
      if (is_array($file)) {
        if ($file['list'] && file_exists($file['filepath'])) {
          $image = ad_image_validate_size((object) $file, $node->nid);
          if ($image !== FALSE) {
            $image->fid = $file['fid'];
            return $image;
          }
        }
      }
      else {
        if ($file->list && file_exists($file->filepath)) {
          $image = ad_image_validate_size($file, $node->nid);
          if ($image !== FALSE) {
            $image->fid = $file->fid;
            return $image;
          }
        }
      }
    }
  }
  return FALSE;
}