示例#1
0
/**
 * Returns the path to an image asset.
 *
 * <b>Example:</b>
 * <code>
 *  echo image_path('foobar');
 *    => /images/foobar.png
 * </code>
 *
 * <b>Note:</b> The asset name can be supplied as a...
 * - full path, like "/my_images/image.gif"
 * - file name, like "rss.gif", that gets expanded to "/images/rss.gif"
 * - file name without extension, like "logo", that gets expanded to "/images/logo.png"
 * 
 * @param  string $source    asset name
 * @param  bool   $absolute  return absolute path ?
 *
 * @return string file path to the image file
 * @see    image_tag  
 */
function image_path($source, $absolute = false, $override = false)
{
    // CHANGE TO SYMFONY'S ASSETHELPER
    if (!$override && sfConfig::get('app_amazon_enable_s3')) {
        $source = ImageTable::generateS3Url($source);
    }
    return _compute_public_path($source, 'images', 'png', $absolute);
}
 function downloadLarge($filename)
 {
     $url = ImageTable::generateS3Url(ImageTable::getPath($filename, 'large'));
     return $this->downloadToTmp($url, $filename);
 }
示例#3
0
 static function getImages($id, $options = array())
 {
     $db = Doctrine_Manager::connection();
     // include images belonging to individuals that part of couples on the list
     $entityIds = self::getEntityIds($id, array('expand_couples' => $options['expand_couples']));
     if (count($entityIds) > 0) {
         if (isset($options['with_address']) && $options['with_address'] == '1') {
             $sql = 'SELECT i.entity_id, i.id AS image_id, i.filename FROM image i WHERE i.entity_id IN(' . join(',', $entityIds) . ') AND i.is_deleted = 0 AND i.address_id IS NOT NULL';
         } else {
             if (isset($options['all_images']) && $options['all_images'] == '1') {
                 $sql = 'SELECT i.entity_id, i.id AS image_id, i.filename FROM image i WHERE i.entity_id IN(' . join(',', $entityIds) . ') AND i.is_deleted = 0';
             } else {
                 $sql = 'SELECT i.entity_id, i.id AS image_id, i.filename FROM image i WHERE i.entity_id IN(' . join(',', $entityIds) . ') AND i.is_featured = 1 AND i.is_deleted = 0 AND i.address_id IS NULL';
             }
         }
         $stmt = $db->execute($sql, array($id));
         $rows = $stmt->fetchAll();
     } else {
         $rows = array();
     }
     return array_map(function ($row) {
         return array('id' => intval($row['entity_id']), 'url' => ImageTable::generateS3Url('profile/' . $row['filename']), 'image_id' => intval($row['image_id']));
     }, $rows);
 }
示例#4
0
function ls_image_tag($source, $options = array())
{
    if (sfConfig::get('app_amazon_enable_s3')) {
        $source = ImageTable::generateS3Url($source);
    }
    return image_tag($source, $options);
}