Пример #1
0
 case 'array':
     #---------------------------------------------------------------------------
     $Table = new Tag('TABLE', array('cellspacing' => 10));
     #---------------------------------------------------------------------------
     $Tr = new Tag('TR');
     #---------------------------------------------------------------------------
     foreach ($Images as $Image) {
         #-------------------------------------------------------------------------
         if (Count($Tr->Childs) % $Groups == 0) {
             #-----------------------------------------------------------------------
             $Table->AddChild($Tr);
             #-----------------------------------------------------------------------
             $Tr = new Tag('TR');
         }
         #-------------------------------------------------------------------------
         $Size = Image_Get_Size($Image['FileData']);
         if (Is_Error($Size)) {
             return ERROR | @Trigger_Error(500);
         }
         #-------------------------------------------------------------------------
         $Index = $Size['Height'] / $Size['Width'];
         #-------------------------------------------------------------------------
         $Height = $Width * $Index;
         #-------------------------------------------------------------------------
         $Img = new Tag('IMG', array('border' => 0, 'width' => $Width, 'height' => $Height, 'style' => 'border:1px solid #DCDCDC;cursor:pointer;', 'title' => $Image['Comment'], 'src' => SPrintF('/ClauseImage?ImageID=%u&Width=%u', $Image['ID'], $Width)));
         #-------------------------------------------------------------------------
         $Img->AddAttribs(array('onclick' => SPrintF('ClauseImageShow(%u,this);', $Image['ID'])));
         #-------------------------------------------------------------------------
         $Tr->AddChild(new Tag('TD', $Img, new Tag('DIV', array('align' => 'center', 'style' => 'font-size:11px;color:#969696;'), $Image['Comment'])));
     }
     #---------------------------------------------------------------------------
Пример #2
0
if (Is_Error(System_Load('libs/Image.php'))) {
    return ERROR | @Trigger_Error(500);
}
#-------------------------------------------------------------------------------
$Image = DB_Select('ClausesFiles', array('FileName', 'FileData'), array('UNIQ', 'ID' => $ImageID));
#-------------------------------------------------------------------------------
switch (ValueOf($Image)) {
    case 'error':
        return ERROR | @Trigger_Error(500);
    case 'exception':
        return ERROR | @Trigger_Error(400);
    case 'array':
        #---------------------------------------------------------------------------
        $Image = $Image['FileData'];
        #---------------------------------------------------------------------------
        $Size = Image_Get_Size($Image);
        if (Is_Error($Size)) {
            return ERROR | @Trigger_Error(500);
        }
        #---------------------------------------------------------------------------
        $Index = $Size['Height'] / $Size['Width'];
        #---------------------------------------------------------------------------
        if ($Width) {
            #-------------------------------------------------------------------------
            $Height = $Width * $Index;
            #-------------------------------------------------------------------------
            $Image = Image_Resize($Image, (int) $Width, (int) $Height);
            if (Is_Error($Image)) {
                return ERROR | @Trigger_Error(500);
            }
            #-------------------------------------------------------------------------