Back to PhocaGalleryImage class

Method setBoxSize

public static
setBoxSize
(mixed $p, mixed $type = 1)

Method setBoxSize - Source code

/*
 * type ... 1 categories, 2 category view
 */
public static function setBoxSize($p, $type = 1)
{
    $w = 20;
    $w2 = 25;
    $w3 = 18;
    $w4 = 40;
    $boxWidth = 0;
    $boxSize['width'] = 0;
    $boxSize['height'] = 0;
    if (isset($p['imagewidth'])) {
        $boxSize['width'] = $boxSize['width'] + (int) $p['imagewidth'];
    }
    if (isset($p['imageheight'])) {
        $boxSize['height'] = $boxSize['height'] + (int) $p['imageheight'];
    }
    if (isset($p['display_name']) && ($p['display_name'] == 1 || $p['display_name'] == 2)) {
        $boxSize['height'] = $boxSize['height'] + $w;
    }
    if ($type == 3) {
        $boxSize['height'] = $boxSize['height'] + $w;
        return $boxSize;
    }
    if (isset($p['display_rating']) && $p['display_rating'] == 1 || isset($p['display_rating_img']) && $p['display_rating_img'] > 0) {
        if ($type == 1) {
            $boxSize['height'] = $boxSize['height'] + $w4;
        } else {
            $boxSize['height'] = $boxSize['height'] + $w;
        }
    }
    if (isset($p['displaying_tags_true']) && $p['displaying_tags_true'] == 1) {
        $boxSize['height'] = $boxSize['height'] + (int) +$w3;
    }
    if (isset($p['display_icon_detail']) && $p['display_icon_detail'] == 1) {
        $boxWidth = $boxWidth + $w;
    }
    if (isset($p['display_icon_download']) && (int) $p['display_icon_download'] > 0) {
        $boxWidth = $boxWidth + $w;
    }
    if (isset($p['display_icon_vm']) && $p['display_icon_vm'] == 1) {
        $boxWidth = $boxWidth + $w;
    }
    if (isset($p['start_cooliris']) && $p['start_cooliris'] == 1) {
        $boxWidth = $boxWidth + $w;
    }
    if (isset($p['trash']) && $p['trash'] == 1) {
        $boxWidth = $boxWidth + $w;
    }
    if (isset($p['publish_unpublish']) && $p['publish_unpublish'] == 1) {
        $boxWidth = $boxWidth + $w;
    }
    if (isset($p['display_icon_geo_box']) && $p['display_icon_geo_box'] == 1) {
        $boxWidth = $boxWidth + $w;
    }
    if (isset($p['display_camera_info']) && $p['display_camera_info'] == 1) {
        $boxWidth = $boxWidth + $w;
    }
    if (isset($p['display_icon_extlink1_box']) && $p['display_icon_extlink1_box'] == 1) {
        $boxWidth = $boxWidth + $w;
    }
    if (isset($p['display_icon_extlink2_box']) && $p['display_icon_extlink2_box'] == 1) {
        $boxWidth = $boxWidth + $w;
    }
    if (isset($p['approved_not_approved']) && $p['approved_not_approved'] == 1) {
        $boxWidth = $boxWidth + $w;
    }
    if (isset($p['display_icon_commentimg_box']) && $p['display_icon_commentimg_box'] == 1) {
        $boxWidth = $boxWidth + $w;
    }
    $boxHeightRows = ceil($boxWidth / $boxSize['width']);
    $boxSize['height'] = $w * $boxHeightRows + $boxSize['height'];
    // LAST
    if ($type == 1) {
        if (isset($p['categories_box_space'])) {
            $boxSize['height'] = $boxSize['height'] + (int) $p['categories_box_space'];
        }
    } else {
        if (isset($p['category_box_space'])) {
            $boxSize['height'] = $boxSize['height'] + (int) $p['category_box_space'];
        }
    }
    return $boxSize;
}