/** * Get total photo galleries count * @param bool $all * @return mixed */ protected function totalPhotoGalleries($all = false) { if (!$all) { return $this->photoGallery->where('is_published', 1)->where('lang', $this->getLang())->count(); } return $this->photoGallery->where('lang', $this->getLang())->count(); }
* @license http://www.gnu.org/licenses/gpl-2.0.html GPLv2 * @link http://www.familycms.com/wiki/ * @since 3.0 */ if (!isset($_GET['id'])) { logError(__FILE__ . ' [' . __LINE__ . '] No photo id given.'); return; } session_start(); define('URL_PREFIX', '../'); define('GALLERY_PREFIX', ''); require URL_PREFIX . 'fcms.php'; load('gallery'); init('gallery/'); // Globals $galleryObj = new PhotoGallery($fcmsError, $fcmsDatabase, $fcmsUser); $id = (int) $_GET['id']; $size = 'thumbnail'; if (isset($_GET['size'])) { if ($_GET['size'] == 'medium') { $size = 'medium'; } elseif ($_GET['size'] == 'full') { $size = 'full'; } } // Get photo data // Session if (isset($_SESSION['photo-path-data'][$id])) { $photo = $_SESSION['photo-path-data'][$id]; } else { $sql = "SELECT p.`id`, p.`user`, p.`filename`, p.`external_id`, e.`thumbnail`, e.`medium`, e.`full`\n FROM `fcms_gallery_photos` AS p\n LEFT JOIN `fcms_gallery_external_photo` AS e ON p.`external_id` = e.`id`\n WHERE p.`id` = ?";
} } else { $full_path = ""; } $_POST = sanitize($_POST); $photos = $_POST; settype($photos,'object'); PhotoGallery::updatePhotoGallery($photos,$full_path); $success = "Photo Successfully Saved!"; $updates = 'Update photo gallery content'; AdminAction::addAdminAction($_SESSION['admin_name'],$updates); } $photos = PhotoGallery::findPhotoGallery($_REQUEST['id']); ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo $ROOT_URL; ?> _admin/_assets/css/core3.css" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo $ROOT_URL; ?> _admin/_assets/css/modules.css" /> <script type="text/javascript" src="<?php
<h3>Photo Overview</h3> <a href="#" class="switch_thumb"><!-- Switch Thumb --></a> <ul class="display"> <?php $count_record = PhotoGallery::countPhotoGallery(); if (!isset($_REQUEST['page'])) { $page = 1; } else { $page = $_GET[page]; } $pagination = new Pagination(); //for display $pg = $pagination->page_pagination(20, $count_record, $page, 20); //$result_prod = mysql_query($query_Recordset2.$pg[1]); $photo = PhotoGallery::findAll($pg[1]); ?> <? if($count_record == 0) { ?> <li> <div style="font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#F00; font-weight:bold">No Record Found</div> </li> <? } else { foreach($photo as $photos) { $image = substr($photos->fldPhotoGalleryImage,9); ?> <li> <div class="content_block"> <a href="#"><img src="<?php echo $ROOT_URL; echo $image; ?> " width="215" alt=""></a>
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = PhotoGallery::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
* * @category FCMS * @package FamilyConnections * @author Ryan Haudenschilt <*****@*****.**> * @copyright 2007 Haudenschilt LLC * @license http://www.gnu.org/licenses/gpl-2.0.html GPLv2 * @link http://www.familycms.com/wiki/ */ session_start(); define('URL_PREFIX', '../'); define('GALLERY_PREFIX', ''); require URL_PREFIX . 'fcms.php'; load('gallery'); init('gallery/'); // Globals $fcmsGallery = new PhotoGallery($fcmsError, $fcmsDatabase, $fcmsUser); echo ' <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . T_pgettext('Language Code for this translation', 'lang') . '" lang="' . T_pgettext('Language Code for this translation', 'lang') . '"> <head> <title>' . T_('Photo Gallery Slideshow') . ' - ' . getSiteName() . '</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta name="author" content="Ryan Haudenschilt" /> <link rel="shortcut icon" href="../ui/favicon.ico"/> <style type="text/css"> html { background-color: #000; } body { overflow: hidden; text-align: center; } ul { margin: 0 auto; padding: 0; } ul > li { list-style-type: none; } </style> <script type="text/javascript" src="../ui/js/jquery.js"></script>
/** * uploadImages * * @param string $filetype * @param string $filename * @param string $filetmpname * @param string $destination * @param int $max_h * @param int $max_w * @param boolean $unique * @param boolean $show * @param boolean $square * * @return string */ function uploadImages($filetype, $filename, $filetmpname, $destination, $max_h, $max_w, $unique = false, $show = true, $square = false) { $fcmsError = FCMS_Error::getInstance(); $fcmsDatabase = Database::getInstance($fcmsError); $fcmsUser = new User($fcmsError, $fcmsDatabase); if ($fcmsError->hasError()) { $fcmsError->displayError(); return; } include_once 'gallery_class.php'; $currentUserId = (int) $_SESSION['fcms_id']; $gallery = new PhotoGallery($fcmsError, $fcmsDatabase, $fcmsUser); $known_photo_types = array('image/pjpeg' => 'jpeg', 'image/jpeg' => 'jpg', 'image/gif' => 'gif', 'image/bmp' => 'bmp', 'image/x-png' => 'png', 'image/png' => 'png'); $gd_function_suffix = array('image/pjpeg' => 'JPEG', 'image/jpeg' => 'JPEG', 'image/gif' => 'GIF', 'image/bmp' => 'WBMP', 'image/x-png' => 'PNG', 'image/png' => 'PNG'); // Get extension of photo $ext = explode('.', $filename); $ext = end($ext); $ext = strtolower($ext); // Check mime type if (!array_key_exists($filetype, $known_photo_types)) { echo ' <p class="error-alert"> ' . sprintf(T_('Error: File %s is not a photo. Photos must be of type (.JPG, .JPEG, .GIF, .BMP or .PNG).'), $filetype) . ' </p>'; // Check file extension } elseif (!in_array($ext, $known_photo_types)) { echo ' <p class="error-alert"> ' . sprintf(T_('Error: File %s is not a photo. Photos must be of type (.JPG, .JPEG, .GIF, .BMP or .PNG).'), $filetype) . ' </p>'; } else { // Make filename unique if ($unique) { $new_id = uniqid(""); $extention = $known_photo_types[$filetype]; $filename = $new_id . "." . $extention; } copy($filetmpname, $destination . $filename); $size = GetImageSize($destination . $filename); if ($square) { $thumbnail = $gallery->getResizeSizeSquare($size[0], $size[1], $max_w); $temp_width = $thumbnail[0]; $temp_height = $thumbnail[1]; $width = $thumbnail[2]; $height = $thumbnail[3]; } else { $thumbnail = $gallery->getResizeSize($size[0], $size[1], $max_w, $max_h); $temp_width = $thumbnail[0]; $temp_height = $thumbnail[1]; $width = $thumbnail[0]; $height = $thumbnail[1]; } if ($size[0] > $max_w && $size[1] > $max_h) { $function_suffix = $gd_function_suffix[$filetype]; $function_to_read = "ImageCreateFrom" . $function_suffix; $function_to_write = "Image" . $function_suffix; $source_handle = $function_to_read($destination . $filename); if ($source_handle) { $destination_handle = ImageCreateTrueColor($width, $height); ImageCopyResampled($destination_handle, $source_handle, 0, 0, 0, 0, $temp_width, $temp_height, $size[0], $size[1]); } $function_to_write($destination_handle, $destination . $filename); ImageDestroy($destination_handle); } } // Show thumbnail? if ($show) { echo "<img src=\"" . $destination . $filename . "\" alt=\"\"/>"; } return $filename; }
<?php // Include the PhotoGallery class include 'resources/PhotoGallery.php'; //Get folder to load if (isset($_GET['variable'])) { $variable = $_GET['variable']; } else { $variable = './gallery-images/4-Color Process'; // default folder } // Initialize the PhotoGallery object $gallery = new PhotoGallery(); // Initialize the gallery array $galleryArray = $gallery->readImageDirectory($variable); // Define theme path if (!defined('THEMEPATH')) { define('THEMEPATH', $gallery->getThemePath()); } // Set path to theme index $themeIndex = $gallery->getThemePath(true) . '/index.php'; // Initialize the theme if (file_exists($themeIndex)) { include $themeIndex; } else { die('ERROR: Failed to initialize theme'); }
<? require_once($_SERVER["DOCUMENT_ROOT"]."/constants.php"); require_once($_SERVER["DOCUMENT_ROOT"]."/../Classes/provart/photo_gallery.php"); validarParametro(isset($_REQUEST["crp"])); if (!isset($_REQUEST["pagina"])) $_REQUEST["pagina"] = 1; $photoGallery = new PhotoGallery(5, DATA_FOTOS_PATH.base64_decode($_REQUEST["crp"]), 680, 3); $photoGallery->setPageNumber($_REQUEST["pagina"]); $photoGallery->setTitle(base64_decode($_REQUEST["ttl"])); $photoGallery->Draw(); ?>
$new_name = 'Photos'.GetSID(7); //$new_name = (isset($_POST['name'])) ? $_POST['name'] : ""; if ($my_upload->upload($new_name)) { // new name is an additional filename information, use this to rename the uploaded file $full_path = $my_upload->upload_dir.$my_upload->file_copy; $info = $my_upload->get_uploaded_file_info($full_path); // ... or do something like insert the filename to the database } } else { $full_path = ""; } $_POST = sanitize($_POST); $photos = $_POST; settype($photos,'object'); PhotoGallery::addPhotoGallery($photos,$full_path); $success = "Photo Successfully Saved!"; $updates = 'Add new photo gallery content'; AdminAction::addAdminAction($_SESSION['admin_name'],$updates); } ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-us" lang="en-us"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" /> <link rel="stylesheet" type="text/css" media="screen" href="<?php echo $ROOT_URL; ?> _admin/_assets/css/core3.css" />