Beispiel #1
0
function ViewPhotos2($photos, $n = 1, $total = 1, $w = 100, $h = 100)
{
    $Ext_arr_images = array("jpg", "jpeg", "gif", "png");
    //$photos = explode(',', $photos);
    $photos = Files($photos);
    $photos = getOrgFiles($photos);
    $file = '';
    $allPhotos = '';
    $path = '../../uploads/';
    $reziseFolder = "uploads/cash/thumb_";
    $nophoto = '<div class=" listViewFileDiv noPhoto" style="width:' . $w . 'px; height:' . $h . 'px">&nbsp;</div>';
    if ($photos) {
        $phs = explode(',', $photos);
        $all = count($phs);
        if ($n > $all) {
            $n = $all;
        }
        for ($i = 0; $i < $n; $i++) {
            $y = $phs[$i];
            $photo = $path . $phs[$i];
            $file = $path . $phs[$i];
            $photo_ex = getFileEx($phs[$i]);
            $FN = explode('/', $phs[$i]);
            $fileName = end($FN);
            $xFile = 0;
            if (file_exists($photo)) {
                if (!in_array($photo_ex, $Ext_arr_images)) {
                    $path = '../includes/css/images/filesTypes/';
                    $photo = $path . $photo_ex . '.png';
                    $fileName = $photo_ex . '.png';
                    if (!file_exists($photo)) {
                        $xFile = 1;
                    }
                } else {
                    $path = '../../uploads/';
                }
                if ($xFile == 0) {
                    $thamp = resizeToFile($photo, $w, $h, '../../' . $reziseFolder . str_replace('/', '_', $phs[$i]));
                    if ($thamp != '') {
                        if ($total > 1) {
                            $allPhotos .= '<div class="totalPhotos">' . $all . '</div>';
                        }
                        $allPhotos .= '
						<div class="listViewFileDiv" style="float:left;width:' . $w . 'px; height:' . $h . 'px;background-image:url(' . $thamp . ')" 
						onclick="window.open(\'' . $file . '\',\'\',\'width=800,height=500\')" ></div>';
                    } else {
                        $allPhotos .= $nophoto;
                    }
                } else {
                    $allPhotos .= $nophoto;
                }
            } else {
                if ($photo != "") {
                    $fileName = str_replace('&feature=youtu.be', '', $fileName);
                    $fileName = str_replace('watch?v=', '', $fileName);
                    return '<img src="http://img.youtube.com/vi/' . $fileName . '/1.jpg"  width="' . $w . '" style="margin:5px" border="0" >';
                } else {
                    return '<img src="../includes/css/images/filesTypes/x.png" width="' . $w . '" style="margin:5px" border="0" >';
                }
            }
        }
    } else {
        return $nophoto;
    }
    return $allPhotos;
}
Beispiel #2
0
function ViewPhotos($photos, $n = '', $w = 100, $h = 100)
{
    $file = '';
    $allPhotos = '';
    $path = '../../uploads/';
    $reziseFolder = "uploads/cash/thumb_";
    $nophoto = '<div class=" listViewFileDiv noPhoto" style="width:' . $w . 'px; height:' . $h . 'px">&nbsp;</div>';
    if ($photos) {
        $phs = explode(',', $photos);
        $all = count($phs);
        if ($n == '' || $n > count($phs)) {
            $n = count($phs);
        }
        for ($i = 0; $i < $n; $i++) {
            $photo = $path . getPhotoFolder($phs[$i]) . '/' . $phs[$i];
            $ohito_ex = getFileEx($phs[$i]);
            if (file_exists($photo)) {
                $thamp = resizeToFile($photo, $w, $h, '../../' . $reziseFolder . $phs[$i]);
                if ($thamp != '') {
                    if ($n == 1) {
                        $allPhotos .= '<div class="totalPhotos">Photos: <b>' . $all . '</b></div>';
                    }
                    $allPhotos .= '
					<div class="listViewFileDiv" style="float:left;width:' . $w . 'px; height:' . $h . 'px;background-image:url(' . $thamp . ')" 
					onclick="window.open(\'' . $photo . '\',\'\',\'width=800,height=500\')" ></div>';
                } else {
                    $allPhotos .= $nophoto;
                }
            } else {
                return '<img src="../includes/css/images/filesTypes/x.png" width="100" style="margin:5px" border="0" >';
            }
        }
    } else {
        return $nophoto;
    }
    return $allPhotos;
}