Esempio n. 1
0
 function refreshSiteThumb($iSiteId)
 {
     $aSite = $this->_oDb->getSiteById($iSiteId);
     if (count($aSite) > 0) {
         $aSTWOptions = array('RefreshOnDemand' => true);
         bx_sites_import('STW');
         deleteThumbnail($aSite['url']);
         $sThumbHTML = getThumbnailHTML($aSite['url'], $aSTWOptions);
         return $sThumbHTML;
     }
     return false;
 }
Esempio n. 2
0
/**
 * Loeschen eines Bildes
 * @param int $pho_id
 * @param int $pic_nr
 */
function deletePhoto($pho_id, $pic_nr)
{
    global $gDb;
    // nur bei gueltigen Uebergaben weiterarbeiten
    if (is_numeric($pho_id) && is_numeric($pic_nr)) {
        // einlesen des Albums
        $photo_album = new TablePhotos($gDb, $pho_id);
        // Speicherort
        $album_path = SERVER_PATH . '/adm_my_files/photos/' . $photo_album->getValue('pho_begin', 'Y-m-d') . '_' . $photo_album->getValue('pho_id');
        // delete photos
        tryDelete($album_path . '/' . $pic_nr . '.jpg');
        tryDelete($album_path . '/originals/' . $pic_nr . '.jpg');
        tryDelete($album_path . '/originals/' . $pic_nr . '.png');
        // Umbenennen der Restbilder und Thumbnails loeschen
        $new_pic_nr = $pic_nr;
        $thumbnail_delete = false;
        for ($act_pic_nr = 1; $act_pic_nr <= $photo_album->getValue('pho_quantity'); ++$act_pic_nr) {
            if (file_exists($album_path . '/' . $act_pic_nr . '.jpg')) {
                if ($act_pic_nr > $new_pic_nr) {
                    tryRename($album_path . '/' . $act_pic_nr . '.jpg', $album_path . '/' . $new_pic_nr . '.jpg');
                    tryRename($album_path . '/originals/' . $act_pic_nr . '.jpg', $album_path . '/originals/' . $new_pic_nr . '.jpg');
                    tryRename($album_path . '/originals/' . $act_pic_nr . '.png', $album_path . '/originals/' . $new_pic_nr . '.png');
                    ++$new_pic_nr;
                }
            } else {
                $thumbnail_delete = true;
            }
            if ($thumbnail_delete) {
                // Alle Thumbnails ab dem geloeschten Bild loeschen
                deleteThumbnail($photo_album, $act_pic_nr);
            }
        }
        //for
        // Aendern der Datenbankeintaege
        $photo_album->setValue('pho_quantity', $photo_album->getValue('pho_quantity') - 1);
        $photo_album->save();
    }
}