garethhall Posted May 25, 2009 Share Posted May 25, 2009 Hello to all you pros out there I have been developing a photo / gallery website and my issue is I think it's running slow? please confirm if you think its slow to. Perhaps there is a better way of writing my code? Here is the url http://www.communica.co.nz/concepts/smart-photography.co.nz/ Here is my code for one of my pages <?php require_once('Connections/content.php'); ?> <?php mysql_select_db($database_content, $content); //Get public albums include("includes/publicAlbums.php"); include("includes/getPageDetails.php"); $pageDetailsSQL = "SELECT * FROM pages WHERE pageId = 3"; $recordPageDetails = mysql_query($pageDetailsSQL, $content) or die(mysql_error()); $rowPageDetails = mysql_fetch_assoc($recordPageDetails); //check if page is ative if($rowPageDetails['pageStatus'] <> "on"){ header("Location: construction.php"); }else{ if(!$_GET['albumID']){// if album ID is not set redirect to indexpage header("Location: index.php"); } } // Protect Variables from SQL injection function checkVars($value){ // Stripslashes if (get_magic_quotes_gpc()){ $value = stripslashes($value); } // Quote if not a number if (!is_numeric($value)){ $value = "'" . mysql_real_escape_string($value) . "'"; } return $value; }; //Set Variables $albumID = checkVars(base64_decode($_GET[albumID])); // Sql select query $SQLgetPhotosPublic = "SELECT photos.photoID, photos.photoName, photos.photoDate, albums.albumName, albums.albumDesc, albums.albumType FROM photos INNER JOIN albums ON photos.albumId = albums.albumID WHERE albums.albumID = $albumID;"; $rs_getPhotosPublic= mysql_query($SQLgetPhotosPublic, $content) or die(mysql_error()); $row_getPhotosPublic = mysql_fetch_assoc($rs_getPhotosPublic); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta name="keywords" content="<?php echo $rowPageDetails['pageMetaKeywords']; ?>" /> <meta name="description" content="<?php echo $rowPageDetails['pageMetaDescription']; ?>" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title><?php echo $rowPageDetails['pageMetaTitle']; ?></title> <link rel="shortcut icon" href="images/favicon.ico" /> <link href="css/sp.css" rel="stylesheet" type = "text/css" /> <link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" /> <script type="text/javascript" src="js/prototype.js"></script> <script type="text/javascript" src="js/scriptaculous.js?load=effects,builder"></script> <script type="text/javascript" src="js/lightbox.js"></script> <?php do { echo $rowOptionalData['optionalDataKey']."\n"; } while ($rowOptionalData = mysql_fetch_assoc($recordOptionalData)); ?> <link href="css/gallery.css" rel="stylesheet" type="text/css" /> </head> <body id="gallery"> <div id="container"> <!--Head and nav--> <?php include('includes/head.php');?> <!--Home gallery--> <div id="galleryContent"> <!--pagination--> <div id="pagination"> <div class="button"> <a href=""><img src="images/prevBtn.gif" alt="Previous" border="0" /></a> <a href=""><img src="images/nextBtn.gif" alt="Next" border="0" /></a> </div> <div class="page">page 1 | <a href="">2</a> | <a href="">3</a></div> </div> <!--Home gallery thumbs--> <h1 class="gallery">Gallery : <?php echo $row_getPhotosPublic['albumName'] ?></h1> <ul class="ulPhoto"> <?php //output photo thumbnails if($_GET['albumType'] == "image"){ do{ $i++; ?> <li><a href="CMS/smartP/photos/<?php echo $row_getPhotosPublic['photoName']; ?>" rel="lightbox[photos]" title="<?php echo $row_getPhotosPublic['photoName']; ?>"><img src="CMS/smartP/thumb/<?php echo $row_getPhotosPublic['photoName']; ?>" alt="1" class="ImgBorder"/></a> <div class="photoDetail"> <div class="numbers"><?php echo $i ?></div> </div></li><? } while($row_getPhotosPublic = mysql_fetch_assoc($rs_getPhotosPublic)); // output Quitime mov links }else if($_GET['albumType'] == "quicktime"){ do{ ?> <li><a href="quickTimeHolder.php?photoID=<? echo base64_encode($row_getPhotosPublic['photoID']) ?>"><img src="images/quicktimeLogo.png" width="72" height="72" /><br /> <? echo $row_getPhotosPublic['photoName']; ?></a></li> <? } while($row_getPhotosPublic = mysql_fetch_assoc($rs_getPhotosPublic)); }else if($_GET['albumType'] == "flash"){ echo "flash"; }else{ echo "No gallery type selected"; } ?> <!--pagination--> </ul> </div> <!--Foot--> <?php include('includes/foot.php');?> </div> </body> </html> Link to comment https://forums.phpfreaks.com/topic/159623-php-slow/ Share on other sites More sharing options...
fantomel Posted May 25, 2009 Share Posted May 25, 2009 i think your code is fine your host has problems with bandwidth for some users and your pictures which are high quality .. make it harder to load. Link to comment https://forums.phpfreaks.com/topic/159623-php-slow/#findComment-841915 Share on other sites More sharing options...
kevinkorb Posted May 25, 2009 Share Posted May 25, 2009 I noticed that after being on your home page for a little bit my browser had downloaded 2Megs. Your images are very large, I would optimize them. Your PHP is probably fine. Link to comment https://forums.phpfreaks.com/topic/159623-php-slow/#findComment-841927 Share on other sites More sharing options...
fantomel Posted May 25, 2009 Share Posted May 25, 2009 I noticed that after being on your home page for a little bit my browser had downloaded 2Megs. Your images are very large, I would optimize them. Your PHP is probably fine. he is right optimize them and then for each add a download link as full quality picture i would say :-? Link to comment https://forums.phpfreaks.com/topic/159623-php-slow/#findComment-841930 Share on other sites More sharing options...
BobcatM Posted May 26, 2009 Share Posted May 26, 2009 Geez nice house! Link to comment https://forums.phpfreaks.com/topic/159623-php-slow/#findComment-842010 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.