Hello,
I am a bit stuck on how to produce this.
What I am needing to create is a script were the admin user uploads an image from the backend.
The image path and name that is given will be sent to the Gallery Table in the database - imageName and imagePath from this a thumbnail will have to be automatically created and then displayed via the front end.
I am using a lightbox type feature hence why I am so confused on how to code this.
I have been trying to get this to work but then I clicked that I have a seprate thumbnail
I am only working on the front-end code at the momment, so far I have:
A Gallery Manager which will house the SQL query for the class.gallery.php
class.gallery.php - The Working EndPHP Code:
class GalleryManager{
public function getAllImages(){
global $database;
$Query = 'SELECT id, imageName, imagePath FROM Gallery';
$rsResult = $database->query($Query);
$aGallery = array();
while($aImage = $database->fetch_array($rsResult)){
$aGallery[$aImage['id']] = $aImage['imagePath'];
}
return $aGallery;
}
}
Index.php - How The 2 Documents Come TogeatherPHP Code:
define('IMG_PATH', 'includes/images/Gallery/');
include('class.galleryManager.php');
class Gallery{
private $imgRoot = IMG_PATH;
public function getGalleryImages(){
$galleryManager = new GalleryManager();
$aGetPages = $pageManager->getAllImages();
$sOutput .= ''."\n";
$sOutput .= '<div id="gallery-images">'."\n";
foreach($aGetPages as $key => $value){
$sOutput .='<a href="'.$this->imgRoot.$aImage['imagePath'].'" class="zoomBox" title="'.$aImage['imageName'].'"><img src="'.$this->imgRoot.$aImage['imagePath'].'" alt="Image" /></a>'."\n";
}
$sOutput .="</div>"."\n";
}
}
The Navigation Works Fine
PHP Code:
<?php
include('includes/header.php');
include('includes/class/class.gallery.php');
$newNavigation = new Navigation();
$newGallery = new Gallery();
?>
<?php echo $newNavigation->mainMenu();?>
<h1 class="Heading">View Our Work</h1>
<?php echo $newGallery->getGalleryImages();?>
<?php include('includes/footer.php'); ?>


Reply With Quote

Bookmarks