Jump to content

RyanMinor

Members
  • Posts

    117
  • Joined

  • Last visited

Everything posted by RyanMinor

  1. This is my database query SELECT event.*, GROUP_CONCAT(photo_thumbnail) as thumbnails FROM event LEFT JOIN photo ON event_id = photo_event WHERE event_user = ? GROUP BY event.event_id; So I am left with an array in which one of the keys is a comma separated list of thumbnails. I am doing it like this because I am using the live jQuery thumbnail script.
  2. I have a comma separated list of thumbnails coming from my database for each album. I need to add the path to the beginning of each element like so $event['thumbnails'] = thumb.jpg, thumb2.jpg, thumb3.jpg, thumb4.jpg I need to make it so the list above looks like http://site.com/medi...humbs/thumb.jpg, http://site.com/medi...umbs/thumb2.jpg, http://site.com/medi...umbs/thumb3.jpg, http://site.com/medi...umbs/thumb4.jpg How would I go about doing that and ensure that it stays as a comma separated list instead of turning it into an array? Thanks!
  3. Hello, I am trying to output a grid of 3 columns (even if there is only 2 rows returned from the database) similar to a data table, but with divs instead. The data is coming from the database. Below is my current code (which is not working): <?php $end_row = 0; $columns = 3; $loop = 0; foreach ($events as $event) { if ($end_row == 0 && $loop++ != 0) { ?> <div class="left13 section_home"> <?php } ?> <h2><?php echo $event['event_title']; ?></h2> <a href="#"><img src="<?php echo ($event['photo_thumbnail'] != '') ? base_url() . 'media/photos/thumbnail/' . $event['photo_thumbnail'] : base_url() . 'images/no_photo_thumbnail.png'; ?>" alt="" title="" /></a> <p><?php echo ($event['event_description'] != '') ? substr($event['event_description'], 0, strpos($event['event_description'], ' ', 200)) : 'No description yet...'; ?></p> <a href="#" class="section_more"><span class="swirl_left"><span class="swirl_right">View This Event</span></span></a> <?php $end_row++; if($end_row >= $columns) { ?> </div> <?php $end_row = 0; } } if ($end_row != 0) { while ($end_row < $columns) { ?> <div class="left13 section_home"> </div> <?php $end_row++; } ?> <?php } ?> Here is how it should look. How can I adjust my current code to get this? <div class="left13 section_home"> <h2>Wedding <span>Location</span></h2> <a href="#"><img src="images/image_13.jpg" alt="" title="" /></a> <p>Ut enim ad minima veniam, quis nostru <strong>exercitationem</strong> ullam corporis laboriosam, nisi ut aliquid ex ea commodi <strong><a href="#">consequatur</a></strong> </p> <a href="#" class="section_more"><span class="swirl_left"><span class="swirl_right">read more</span></span></a> </div> <div class="left13 section_home"> <h2>Honeymoon <span>Destination</span></h2> <a href="#"><img src="images/image_13_2.jpg" alt="" title="" /></a> <p>Ut enim ad minima veniam, quis nostru <strong>exercitationem</strong> ullam corporis laboriosam, nisi ut aliquid ex ea commodi <strong><a href="#">consequatur</a></strong> </p> <a href="#" class="section_more"><span class="swirl_left"><span class="swirl_right">read more</span></span></a> </div> <div class="left13 section_home"> <h2>Girft <span>Registry</span></h2> <a href="#"><img src="images/image_13_3.jpg" alt="" title="" /></a> <p>Ut enim ad minima veniam, quis nostru <strong>exercitationem</strong> ullam corporis laboriosam, nisi ut aliquid ex ea commodi <strong><a href="#">consequatur</a></strong> </p> <a href="#" class="section_more"><span class="swirl_left"><span class="swirl_right">read more</span></span></a> </div>
  4. I added another line above the first one in the CSV and it worked fine. I hate to have to add a blank line thought everytime I do an upload or if someone else does an upload. Is there any way around this?
  5. I am having a strange issue with running a LOAD DATA INFILE query from a PHP script. Here is my PHP code: $query = $db->prepare("LOAD DATA INFILE ? INTO TABLE csv_data FIELDS TERMINATED BY ',' LINES TERMINATED BY '\r\n' (game_week, home_team, home_score, visitor_team, visitor_score)"); if (!$query->execute(array($location))) { $errors[] = 'CSV upload query failed.'; } else { The first five lines of the csv file are as follows: 1,Abington,24,Fels,8 1,Abington Heights,28,Pittston Area,0 1,Academy Park,29,Marple Newton,20 1,Aliquippa,36,Ambridge,0 1,Allegany MD,56,Southern Garrett MD,6 When I run this query everything gets uploaded perfect except that the first value in the database table for game_week is 0 instead of 1. So the first row looks like this: game_week | home_team | home_score | visitor_team | visitor_score 0 | Abington | 24 | Fels | 8 Why is that first value 0 instead of 1. I really don't understand why this is happening. Any help is greatly appreciated. Also, here is my table structure and I am using XAMPP on Windows 7 if that matters at all: CREATE TABLE csv_data ( game_id int(4) NOT NULL AUTO_INCREMENT, game_date date NOT NULL, game_week tinyint(2) NOT NULL, home_team varchar(250) NOT NULL, home_score tinyint(3) NOT NULL, visitor_team varchar(250) NOT NULL, visitor_score tinyint(3) NOT NULL, PRIMARY KEY (game_id) ) ENGINE=MyISAM AUTO_INCREMENT=675 DEFAULT CHARSET=latin1
  6. I have built a PHP/MySQL CSV uploader/updater to update scores for high school football teams. When I ran this script on XAMPP with Windows 7 I got a permissions error for the "LOAD DATA INFILE" query. I checked my permissions within PHPMyAdmin and the user had all permissions so that isn't it. I need to fix that issue first. I ended up getting everything uploaded by running the query directly on PHPMyAdmin. However, when I try to run the two upload queries my script timed out. The process I am going for here is to upload the file and import the records into a new table (csv_data). Then I want to run the two update queries to update the game table with the new data in the csv_data table. The reason for the two queries is because sometimes the wrong team is in the wrong column as far as home/visitor goes. I find that using CONCAT() is really slowing things down. So I need to first fix my permissions issue with the "LOAD DATA INFILE" query and then figure out a way to speed up my update queries. Any ideas? <?php require_once('global.php'); if (array_key_exists('submit', $_POST)) { if ($_FILES['csv']['error'] > 0){ echo "Error: " . $_FILES['csv']['error'] . "</br>" . "You have not selected a file or there is another error."; } else { $tmp = $_FILES['csv']['tmp_name']; } if (!$_FILES['csv']['type'] == 'text/csv'){ echo "Please select a CSV File"; } else { $location = dirname(__FILE__) . '/csv/' . basename($_FILES['csv']['name']); move_uploaded_file($tmp, $location); } $errors = array(); // Need to get this query to work properly regarding permissions $query = $db->prepare("LOAD DATA INFILE ? INTO TABLE csv_data FIELDS TERMINATED BY ',' LINES TERMINATED BY '\n' (game_week, home_team, home_score, visitor_team, visitor_score)"); if ($query->execute(array($location))) { try { // Need to figure out how to use LIKE instead of = and do it quickly $query_two = $db->prepare("UPDATE game g, csv_data c, team home_team, team visit_team SET g.game_home_score = c.home_score, g.game_visitor_score = c.visitor_score, g.game_complete = 'Y' WHERE g.game_week = c.game_week AND home_team.team_name LIKE CONCAT('%', c.home_team, '%') AND home_team.team_id LIKE CONCAT('%', g.game_home_team, '%') AND visit_team.team_name LIKE CONCAT('%', c.visitor_team, '%') AND visit_team.team_id LIKE CONCAT('%', g.game_visitor_team, '%')"); if (!$query_two->execute()) { $errors[] = 'The first update query failed.'; } $query_three = $db->prepare("UPDATE game g, csv_data c, team home_team, team visit_team SET g.game_home_score = c.visitor_score, g.game_visitor_score = c.home_score, g.game_complete = 'Y' WHERE g.game_week = c.game_week AND home_team.team_name LIKE CONCAT('%', c.visitor_team, '%') AND home_team.team_id LIKE CONCAT('%', g.game_home_team, '%') AND visit_team.team_name LIKE CONCAT('%', c.home_team, '%') AND visit_team.team_id LIKE CONCAT('%', g.game_visitor_team, '%')"); if (!$query_three->execute()) { $errors[] = 'The second update query failed.'; } } catch(PDOException $e) { echo $e->getMessage(); } } else { $errors[] = 'CSV Upload Query Failed.'; } } ?>
  7. Thanks for the reply. I will mess around with this and see what I can come up with.
  8. I am trying to create an automatic score updater for a football database. My client will be emailing me CSV spreadsheets with the game date, home team, home score, visiting team, and visiting score in them. The problem is that I have a separate team table (team_id, team_name, etc.) and game table as outlined below: team (team_id, team_name, etc.) game(game_id, game_home_team, game_home_score, game_visitor_team, game_visitor_score, game_date, game_complete) sample game data(1, 123, 0, 156, 0, 8-31-2012, No) -> I store the team's id instead of their name in the game table. I need to write a script that will update the scores automatically. There will be about 327 scores per week. The CSV will look like the following (with column headings): game_date, home_team, home_score, visitor_team, visitor_score (2012-8-31, Forest Hills, 44, Westmont Hilltop, 0) -> sample data How would I first get the team id's, then match them home and visitor id's with their team names, then get the game id that corresponds to the matching team_id's, then update the scores for that game? That's a lot and I am kind of lost on the issue. Any help or even a better way to do this would be greatly appreciated. Below is what i have so far: UPDATE game SET game_home_score = ?, game_visitor_score = ?, game_complete = 'Yes' WHERE game_id = SELECT game_id FROM game WHERE game_home_team IN ( SELECT team_id FROM team WHERE team_name = ? ) AND game_visitor_team IN ( SELECT team_id FROM team WHERE team_name = ? ); I know that query is wrong, but it's what I was thinking as far as the direction I need to go. My MySQL knowledge isn't quite vast enough (I don't think) to get this working.
  9. How would I go about converting time (could be in hours:minutes:seconds, minutes:seconds, or just seconds format) into the number of seconds? I have a function that will take in hours:minutes:seconds values but when I supply only minutes:seconds or just seconds, it fails. function convertTimeToSeconds($time) { // Check the duration input of time if (!preg_match("/^\d+(:\d{1,2})?(:\d{1,2})?$/", $time)) { throw new exception('Invalid input format for duration.'); } // Retrieve hours, minutes, and seconds $hours = substr($time, 0, -6); $minutes = substr($time, -5, 2); $seconds = substr($time, -2); $total_seconds = ($hours * 3600) + ($minutes * 60) + $seconds; // Ensure that the result is an integer if (!is_int($total_seconds)) { throw new Exception('Output format is not integer.'); } else { return $total_seconds; } }
  10. I am trying to retrieve schedules for each team based on my table below, but I am having some trouble getting the team names to display. Here are my tables my table: TEAM team_id team_name team_mascot etc. GAME game_id game_date game_home_team game_visitor_team game_home_score game_visitor_score game_complete Here is my current query. I am able to get the team's id values with this but I need the team names as id values won't do me much good. SELECT game_home_team, game_visitor_team, game_date FROM game INNER JOIN team home ON home.team_id = game_home_team INNER JOIN team visitor ON visitor.team_id = game_visitor_team WHERE game_home_team = ? OR game_visitor_team = 6 ORDER BY game_date ASC; How can I retrieve the team names with this query and also display a result such as W or L depending on the score for the game? Thanks so much in advance.
  11. Problem solved. It turns out my path was incorrect. I created a file in the root of my site with the following code in it. <?php echo __FILE__; ?> It gave me the full path and once I changed it, everything worked.
  12. Also, here is my Apache Error Log: [Tue May 01 16:48:35 2012] [error] [client 123.125.71.20] File does not exist: /var/chroot/home/content/p/i/n/pinkydinks/html/robots.txt [Tue May 01 19:59:04 2012] [error] [client 95.108.150.235] File does not exist: /var/chroot/home/content/p/i/n/pinkydinks/html/robots.txt [Tue May 01 19:59:04 2012] [error] [client 95.108.150.235] File does not exist: /var/chroot/home/content/p/i/n/pinkydinks/html/robots.txt [Wed May 02 09:44:06 2012] [error] [client 66.249.71.239] File does not exist: /var/chroot/home/content/p/i/n/pinkydinks/html/robots.txt [Wed May 02 11:54:09 2012] [error] [client 173.8.17.253] (2)No such file or directory: Could not open password file: /home/content/p/i/n/html/digrepro/.htpasswd [Wed May 02 11:54:09 2012] [error] [client 173.8.17.253] (2)No such file or directory: Could not open password file: /home/content/p/i/n/html/digrepro/.htpasswd [Wed May 02 11:57:11 2012] [error] [client 173.8.17.253] (2)No such file or directory: Could not open password file: /home/content/p/i/n/html/.htpasswd
  13. I still get the following after trying to log in after putting "AuthBasicProvider file" in my .htaccess file: Internal Server Error The server encountered an internal error or misconfiguration and was unable to complete your request. Please contact the server administrator and inform them of the time the error occurred, and anything you might have done that may have caused the error. More information about this error may be available in the server error log. Apache Server at digrepro.com Port 80 Also, I moved the .htpasswd file one level up (out of the site root) and it still gave me the error. Why does .htaccess have to be such a pain?
  14. I have a website that I am developing for a client. He wants the entire website to be invisible to random users / search engines. I figured .htaccess with a .htpasswd was the way to go. My problem is that I am getting an internal server error after I enter the username and password. How can I get this to work so that him or I can enter the username and password and the site works as normal? This is the .htaccess file: AuthType Basic AuthName "Test Site" AuthUserFile /home/content/p/i/n/html/digrepro/.htpasswd Require valid-user # Options Options -Multiviews Options +FollowSymLinks #Enable mod rewrite RewriteEngine On #the location of the root of your site #if writing for subdirectories, you would enter /subdirectory RewriteBase / #Removes access to CodeIgniter system folder by users. #Additionally this will allow you to create a System.php controller, #previously this would not have been possible. #'system' can be replaced if you have renamed your system folder. RewriteCond %{REQUEST_URI} ^system.* RewriteRule ^(.*)$ /index.php?/$1 [L] #Checks to see if the user is attempting to access a valid file, #such as an image or css document, if this isn't true it sends the #request to index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d #This last condition enables access to the images and css #folders, and the robots.txt file RewriteCond $1 !^(index\.php|images|robots\.txt|css|products|js) RewriteRule ^(.*)$ index.php?/$1 [L] Both the .htaccess and .htpasswd files reside in the web root folder.
  15. Hi, I have a page where I am running two image rotations and also doing Ajax calls to display products. The first image rotation is being done with jqFancyTransitions which works perfectly regarding whether or not I just made an Ajax call. However the other image rotator I had to code myself because jqFancyTransitions wouldn't work with my transparent png images. So I made my own, but when I click a product (which sends an Ajax call), the timing gets messed up. I am kind of new to JS and jQuery so I am not quite sure what is going on. Any direction or suggestions on how to fix this is appreciated. My code is below. <!DOCTYPE html> <html lang="en"> <head> <title><?php echo $page['page_title']; ?> | <?php echo $header['title']; ?></title> <meta charset="utf-8"> <meta name="keywords" content="<?php echo $page['page_meta_keywords']; ?>"/> <meta name="description" content="<?php echo $page['page_meta_description']; ?>"/> <link rel="stylesheet" href="<?php echo base_url(); ?>css/style.css" type="text/css" media="all"> <link href='http://fonts.googleapis.com/css?family=Questrial|Anton' rel='stylesheet' type='text/css'> <script type="text/javascript" src="<?php echo base_url(); ?>js/jquery-1.5.2.js"></script> <script type="text/javascript" src="<?php echo base_url(); ?>js/jqFancyTransitions.js"></script> <script type="text/javascript"> $(document).ready(function(){ $('#slideshowHolder').jqFancyTransitions({ delay: 5000, width: 483, height: 573, }); $('#merchandiseSlider img').hide(); function merchandiseSlider() { $("#merchandiseSlider img").first().appendTo('#merchandiseSlider').hide(); $("#merchandiseSlider img").first().show(); setTimeout(merchandiseSlider, 10000); } merchandiseSlider(); }); function get_record_id(record_id) { $('#dynamic').load('http://digrepro.com/category/product', { "record_id":record_id }); } </script> </head> <body class="main-background"> <div id="main"> <?php $this->load->view('menu_view'); ?> <div id="content"> <!-- START LEFT-CONTENT --> <div id="left-content" style="float:left; width:485px;"> <!-- START ROTATING IMAGES --> <div id="slideshowHolder"> <?php foreach ($rotators as $rotator) { ?> <img src="<?php echo base_url(); ?>images/<?php echo $rotator['rotator_photo']; ?>" width="483px" /> <?php } ?> </div> <!-- END ROTATING IMAGES --> </div> <!-- END LEFT-CONTENT --> <!-- START RIGHT-CONTENT --> <div id="right-content" style="float:right; width:535px;"> <!-- START THUMBNAIL DISPLAY --> <div id="display-content" style="float:left; margin-left:3px; width:50%;"> <div align="center" style="height:140px; color:#FF1EDC; font-size:36px;"> <img src="<?php echo base_url(); ?>images/<?php echo $header['image']; ?>" style="max-height:140px;" /> </div> <table width="100%" cellpadding="5" cellspacing="0"> <tr> <?php $sql_endRow = 0; $sql_columns = 4; $sql_hloopRow1 = 0; foreach ($products as $product) { if($sql_endRow == 0 && $sql_hloopRow1++ != 0) { ?> <tr> <?php } ?> <td align="center"> <a href="javascript:void(0)" onClick="get_record_id(<?php echo $product['product_id']; ?>)"> <img src="<?php echo base_url(); ?>products/<?php echo $product['product_thumbnail']; ?>" class="product-thumb" /> </a> </td> <?php $sql_endRow++; if($sql_endRow >= $sql_columns) { ?> </tr> <?php $sql_endRow = 0; } } if($sql_endRow != 0) { while ($sql_endRow < $sql_columns) { ?> <td> </td> <?php $sql_endRow++; } ?> </tr> <?php }?> </table> <div id="pagination" align="center"> <?php echo $pagination; ?> </div> </div> <!-- END THUMBNAIL DISPLAY --> <!-- START PRODUCT INFORMATION DISPLAY --> <div id="product-display" style="float:right; width:48%; margin-right:2px;"> <div id="dynamic"> <img src="<?php echo base_url(); ?>/products/<?php echo $initial['product_photo']; ?>" width="100%"> <table width="100%" border="0" cellspacing="0" cellpadding="5"> <tr> <td colspan="2" align="center" bgcolor="#000000"> <div style="color:#FF1EDC; font-size:22px;"> <strong><?php echo $initial['product_name']; ?></strong> </div> </td> </tr> <tr> <td colspan="2" align="left" valign="top" bgcolor="#000000" height="45px"> <div style="line-height:120%; margin-left:8px; margin-right:8px;"> <?php echo $initial['product_description']; ?> </div> </td> </tr> <tr> <td align="left" bgcolor="#000000"><div style="margin-left:8px;"><?php echo $initial['product_sku']; ?></div></td> <td align="right" bgcolor="#000000"><div style="margin-right:8px;">$<?php echo $initial['product_price']; ?></div></td> </tr> <tr> <td colspan="2" align="center" bgcolor="#000000"> <form name="add_to_cart" method="post" action="/cart/add"> <input type="hidden" name="id" value="<?php echo $initial['product_id']; ?>"> <input type="hidden" name="name" value="<?php echo $initial['product_name']; ?>"> <label for="quantity"><span style="color:#FF1EDC; font-weight:bold; font-size:16px;">BUY NOW! </span></label> <select name="quantity" style="margin-right:5px;"> <option value="1">1</option> <option value="2">2</option> <option value="3">3</option> <option value="4">4</option> <option value="5">5</option> </select> <input type="hidden" name="price" value="<?php echo $initial['product_price']; ?>"> <input type="hidden" name="color" value="<?php echo $initial['product_color']; ?>"> <input type="submit" name="add" class="submit" value="Add To Cart"> </form> </td> </tr> </table> </div> <div id="merchandiseSlider" style="margin-top:10px;"> <img src="<?php echo base_url(); ?>images/merchandise-slogan-3.png" /> <img src="<?php echo base_url(); ?>images/merchandise-slogan-1.png" /> <img src="<?php echo base_url(); ?>images/merchandise-slogan-2.png" /> </div> </div> <!-- END PRODUCT INFORMATION DISPLAY --> </div> <!-- END RIGHT-CONTENT --> <div style="clear: both;"></div> </div> <?php $this->load->view('social_view'); ?> <div style="clear:both;"></div> </div> </body> </html>
  16. Yes, thumbnails are being created. I actually finished everything by specifying a each sub-directory within the main photo directory. The script worked just as I had intended with the exception of giving me the error I specified. Honestly, this is not the first issue I have run into with GoDaddy hosting. I assumed before even posting this question that it was GoDaddy killing my script. However, after looking over my code does everything look good? It's actually one of my first from-scratch OOP scripts.
  17. The only error I am getting is the internal server error after about 15 seconds. I am using Go Daddy hosting if that provides any insight.
  18. I have a quick question about a script I wrote that searches all .jpg images in a directory (and it's sub-directories) and makes thumbnails of them. The problem I am having is that I am getting an internal server error after about 15 seconds. I have included my script, the class it requires, and my php.ini file that resides in the root of my site. I have searched for a couple of hours online and haven't been able to come up with an answer as to why I am getting that error. The thumbnail file... <?php set_time_limit(0); require_once('classes/Create_Thumbnail.php'); $filter = '.jpg'; $directory = 'media'; // Do not include a trailing slash $it = new RecursiveDirectoryIterator("$directory"); foreach(new RecursiveIteratorIterator($it) as $file) { if (!((strpos(strtolower($file), $filter)) === false) || empty($filter)) { $items[] = preg_replace("#\\\#", "/", $file); } } foreach ($items as $item) { $photo = new Create_Thumbnail($item); $photo->createThumbnail(); } ?> The Create_Thumbnail class... <?php class Create_Thumbnail { private $_photo; private $_photoBasename; private $_photoWidth; private $_photoHeight; private $_photoType; private $_resizedPhoto; private $_thumbFolder; private $_thumbWidth = 125; private $_thumbHeight = 125; private $_thumbSuffix = '_thumb'; private $_thumbnail; /** * Constructor retrieves photo's basename, extension, width, and height. */ public function __construct($photo) { $this->_photo = $photo; $this->_photoBasename = pathinfo($this->_photo, PATHINFO_FILENAME); $this->_extension = pathinfo($this->_photo, PATHINFO_EXTENSION); $this->_thumbFolder = dirname($photo) . '/'; list($this->_photoWidth, $this->_photoHeight, $this->_photoType) = getimagesize($this->_photo); } /** * Method to resize the original image to a size that is much closer to the desired thumbnail size. */ public function resize() { $photoRatio = $this->calculatePhotoRatio(); if ($photoRatio != 1) { $this->_resizedWidth = round($this->_photoWidth * $photoRatio); $this->_resizedHeight = round($this->_photoHeight * $photoRatio); } else { $this->_resizedWidth = $this->_thumbWidth; $this->_resizedHeight = $this->_thumbHeight; } $resource = $this->createResource($this->_photoType, $this->_photo); $resized = imagecreatetruecolor($this->_resizedWidth, $this->_resizedHeight); imagecopyresampled($resized, $resource, 0, 0, 0, 0, $this->_resizedWidth, $this->_resizedHeight, $this->_photoWidth, $this->_photoHeight); $this->_resizedPhoto = $this->_thumbFolder . $this->_photoBasename . '_resized.' . $this->_extension; $this->createNewImage($this->_photoType, $resized, $this->_resizedPhoto); imagedestroy($resource); imagedestroy($resized); return $this->_resizedPhoto; } /** * Method to create the thumbnail. */ public function createThumbnail() { $source = $this->resize(); list($width_original, $height_original, $type) = getimagesize($source); $base_name = pathinfo($source, PATHINFO_FILENAME); $base_name = str_replace('_resized', '', $base_name); $extension = pathinfo($source, PATHINFO_EXTENSION); $source_x = ($width_original / 2) - ($this->_thumbWidth / 2); $source_y = ($height_original / 2) - ($this->_thumbHeight / 2); $resource = $this->createResource($type, $source); $thumb = imagecreatetruecolor($this->_thumbWidth, $this->_thumbHeight); imagecopyresampled($thumb, $resource, 0, 0, $source_x, $source_y, $this->_thumbWidth, $this->_thumbHeight, $this->_thumbWidth, $this->_thumbHeight); $this->_thumbnail = $this->_thumbFolder . $base_name . $this->_thumbSuffix . '.' . $extension; $this->createNewImage($type, $thumb, $this->_thumbnail); unlink($source); return $this->_thumbnail; } /** * Method to create an image resource. */ public function createResource($type, $source) { switch ($type) { case 1: $resource = imagecreatefromgif($source); break; case 2: $resource = imagecreatefromjpeg($source); break; case 3: $resource = imagecreatefrompng($source); break; } return $resource; } /** * Method to calculate the photo ratio. */ public function calculatePhotoRatio() { if ($this->_photoWidth > $this->_photoHeight) { $maximumHeight = $this->_thumbHeight; $photoRatio = $maximumHeight / $this->_photoHeight; } elseif ($this->_photoWidth < $this->_photoHeight) { $maximumWidth = $this->_thumbWidth; $photoRatio = $maximumWidth / $this->_photoWidth; } else { $photoRatio = 1; } return $photoRatio; } /** * Method to create a new image. */ public function createNewImage($type, $source, $destination) { switch ($type) { case 1: if (function_exists('imagegif')) { imagegif($source, $destination); } else { imagejpeg($source, $destination, 50); } break; case 2: imagejpeg($source, $destination, 100); break; case 3: imagepng($source, $destination); break; } } } The php.ini file... file_uploads on upload_max_filesize = 150M post_max_size = 150M max_input_time = -1 max_execution_time = 0 memory_limit = 150M register_argc_argv = false
  19. Nevermind, I fixed it. I just removed the header-photo div and then it worked. Weird!
  20. I recently added a jQuery slider only to notice that my links do not work anymore in my header. Can anybody help me find out why they will not work. All relevant code is below... <!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="en" lang="en"> <head> <meta name="Description" content="" /> <meta name="Keywords" content="" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <link rel="stylesheet" href="includes/global.css" type="text/css" /> <script type="text/javascript" src="includes/flowplayer_3.2.7/flowplayer-3.2.6.min.js"></script> <script type="text/javascript" src="includes/jquery_1.6.1.js"></script> <script type="text/javascript" src="includes/slideshow.js"></script> <script type="text/javascript"> $(document).ready(function() { slideShow(); }); </script> <title></title> </head> <body> <div id="wrap"> <div id="header"> <div id="header-links"> <p><a href="cart.php?action=none">My Cart</a></p> </div> </div> <div id="header-photo"> <div id="gallery"> <a class="show"><img src="../images/header-photo.jpg" width="850" height="250" title="" alt="" rel="" style="border:0; padding:0;" /></a> <a><img src="../images/header-photo-2.jpg" width="850" height="250" title="" alt="" rel="" style="border:0; padding:0;" /></a> <a><img src="../images/header-photo-3.jpg" width="850" height="250" title="" alt="" rel="" style="border:0; padding:0;" /></a> <a><img src="../images/header-photo-4.jpg" width="850" height="250" title="" alt="" rel="" style="border:0; padding:0;" /></a> </div> </div> <div id="nav"> <ul> <li><a href="/index.php">Home</a></li> <li><a href="/my_videos.php">View My Videos</a></li> <li><a href="/search.php">Search Videos</a></li> <li><a href="/contact_us.php">Contact Us</a></li> <li><a href="/links.php">Links</a></li> </ul> </div> Here is my CSS code: /* ======================================== Top Element Styles =========================================== */ html { background: url(../images/background.jpg) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; } body { font: 12px/1.75em Verdana, Tahoma, arial, sans-serif; color: #FFF; margin: 0 0 15px 0; } /* ======================================== Link Styles =========================================== */ a, a:visited { color: #C30; background: inherit; text-decoration: none; } a:hover { color: #C30; background: inherit; padding-bottom: 0; } /* Headers */ h1, h2, h3 { font-family: 'Trebuchet MS', Tahoma, Sans-serif; font-weight: Bold; color: #333; } h1 { font-size: 160%; font-weight: normal; } h2 { font-size: 130%; text-transform: uppercase; } h3 { font-size: 130%; } h1, h2, h3, p { padding: 10px; margin: 0; } ul, ol { margin: 5px 20px; padding: 0 20px; } /* Images */ img { background: #FAFAFA; border: 1px solid #DCDCDC; padding: 5px; } img.float-right { margin: 5px 0px 10px 10px; } img.float-left { margin: 5px 10px 10px 0px; } code { margin: 5px 0; padding: 10px; text-align: left; display: block; overflow: auto; font: 500 1em/1.5em 'Lucida Console', 'courier new', monospace ; /* white-space: pre; */ background: #F5F5F5; border-left: 3px solid #D4D4D4; } acronym { cursor: help; border-bottom: 1px dashed #777; } blockquote { font: bold 1.4em/1.5em 'Trebuchet MS', Tahoma, Sans-serif; margin: 10px; padding: 0 0 0 25px; background: #F5F5F5; border-left: 3px solid #D4D4D4; color: #444; } input.button { font: bold 12px Arial, Sans-serif; height: 24px; margin: 0; padding: 2px 3px; color: #000000; background: #666666; border: 1px solid #dadada; } /******************************************** LAYOUT ********************************************/ #wrap { position: relative; width: 910px; margin: 0 auto; text-align: left; background: #000; /*#fff url(../images/content.jpg) repeat-y center top;*/ } #content-wrap { float: left; width: 850px; margin-left: 30px; display: inline; padding: 0; border-top: 5px solid #000; /*background: #fff url(../images/content-wrap.jpg) repeat-x;*/ /* IE10 */ background-image: -ms-radial-gradient(center, ellipse farthest-side, #FFFFFF -300%, #000000 100%); /* Mozilla Firefox */ background-image: -moz-radial-gradient(center, ellipse farthest-side, #FFFFFF -300%, #000000 100%); /* Opera */ background-image: -o-radial-gradient(center, ellipse farthest-side, #FFFFFF -300%, #000000 100%); /* Webkit (Safari/Chrome 10) */ background-image: -webkit-gradient(radial, center center, 0, center center, 490, color-stop(-3, #FFFFFF), color-stop(1, #000000)); /* Webkit (Chrome 11+) */ background-image: -webkit-radial-gradient(center, ellipse farthest-side, #FFFFFF -300%, #000000 100%); /* Proposed W3C Markup */ background-image: radial-gradient(center, ellipse farthest-side, #FFFFFF -300%, #000000 100%); } #header { position: relative; /*background: #fff url(../images/header-bg.jpg) repeat-y center top;*/ background-color:#000000; height: 35px; width:910px; padding: 0; color: #FFF; } /* Header Links */ #header #header-links { position: absolute; top: 8px; right: 45px; color: #FFF; font-size: 14px; font-weight: bold; } #header #header-links p { padding: 0; margin: 0; } #header #header-links a { color: #FFF; text-decoration: none; } #header #header-links a:hover { color: #666; } /* Header Photo */ #header-photo { position: relative; clear: both; margin: 5px auto; height: 250px; width: 850px; /*background: #fff url(../images/header-photo.jpg) no-repeat center center;*/ background-color:#000; } #header-photo h1#logo-text a { position: absolute; margin: 0; padding: 0; font: bold 48px 'Trebuchet MS', Arial, Sans-serif; letter-spacing: -1px; color: #fff; text-transform: none; text-decoration: none; border: none; /* change the values of top and left to adjust the position of the logo*/ top: 22px; left: 9px; height: 48px; } #header-photo h2#slogan { position: absolute; margin: 0; padding: 0; font: bold 14px 'Trebuchet MS', Arial, Sans-serif; text-transform: none; color: #B6D1F8; /* change the values of top and left to adjust the position of the slogan*/ top: 73px; left: 33px; } /* Navigation */ #nav { clear: both; padding: 0; } #nav ul { float: left; list-style: none; background: #E4E4E4 url(../images/nav.jpg) repeat-x; width: 850px; padding: 0; margin: 0 0 0 30px; height: 45px; display: inline; text-transform: uppercase; } #nav ul li { display: inline; margin: 0; padding: 0; } #nav ul li a { display: block; float: left; width: auto; margin: 0; padding: 0 15px; border-right: 1px solid #dadada; border-left: 1px solid #fafafa; border-bottom: none; color: #555; font: bold 14px/45px "Century Gothic", "Trebuchet MS", Helvetica, Arial, Geneva, sans-serif; text-transform: uppercase; text-decoration: none; letter-spacing: 1px; } #nav ul li a:hover, #nav ul li a:active { color: #326ea1; } #nav ul li#current a { background: #DBDBDB url(../images/nav-current.jpg) repeat-x; } /* Main Column */ .three-col #main { margin: 10px 190px 0 200px; } .two-col #main { margin: 0px 5px 0 200px; } #main h1 { margin: 10px 10px 0 10px; font: normal 1.8em Georgia, "Times New Roman", Times, serif; color: #FFF; padding: 15px 0 2px 0px; border-bottom: 1px solid #dadada; } /* Sidebar */ #sidebar { float: left; width: 195px; margin-top: 10px; } #sidebar a { color:#C63; } #sidebar a:hover { color:#C63; } /* right column */ #rightcolumn { float: right; width: 190px; margin-top: 10px; } #rightcolumn h1, #sidebar h1 { margin: 10px 5px 0 5px; padding: 5px 5px; font: bold 1.4em 'Trebuchet MS', Tahoma, Sans-serif; color: #444; } /* Sidemenu */ ul.sidemenu { text-align: left; margin: 7px 8px 8px 10px; padding: 0; border-top: 1px solid #666; text-decoration: none; } ul.sidemenu li { list-style: none; padding: 4px 0 4px 5px; margin: 0 2px; border-bottom: 1px solid #666; } * html body ul.sidemenu li { height: 1%; } ul.sidemenu li a { text-decoration: none; color: #326ea1; border: none; } ul.sidemenu li a:hover { color: #383d44; border: none; } /* Footer Wrap */ #footer-wrap { clear: both; width: 910px; font-size: 95%; padding: 20px 0; text-align: left; background: #000/* url(../images/footer-bottom.jpg) no-repeat center bottom*/; } #footer-wrap a { color: #C30; } #footer-wrap a:hover { color: #666; } #footer-wrap p { padding: 10px 0; } #footer-wrap h2 { color: #666666; margin: 0; padding: 0 10px; } /* Footer */ #footer { clear: both; color: #000; margin: 0 auto 10px auto; width: 850px; padding: 5px 0; text-align: center; /*background: #F8F7F7;*/ /* IE10 */ background-image: -ms-linear-gradient(top, #FFFFFF -300%, #000000 100%); /* Mozilla Firefox */ background-image: -moz-linear-gradient(top, #FFFFFF -300%, #000000 100%); /* Opera */ background-image: -o-linear-gradient(top, #FFFFFF -300%, #000000 100%); /* Webkit (Safari/Chrome 10) */ background-image: -webkit-gradient(linear, left top, left bottom, color-stop(-3, #FFFFFF), color-stop(1, #000000)); /* Webkit (Chrome 11+) */ background-image: -webkit-linear-gradient(top, #FFFFFF -300%, #000000 100%); /* Proposed W3C Markup */ background-image: linear-gradient(top, #FFFFFF -300%, #000000 100%); /*border-top: 1px solid #F2F2F2;*/ } /* Alignment Classes */ .float-left { float: left; } .float-right { float: right; } .align-left { text-align: left; } .align-right { text-align: right; } /* Display and Additional Classes */ .clear { clear: both; } /* Post */ .post-by { font-size: .95em; padding-top: 0; } .post-footer { background: #F5F5F5; padding: 5px; margin: 20px 10px 0 10px; font-size: 95%; color: #666666; } .post-footer .date{ margin: 0 10px 0 5px; } .post-footer a.comments { margin: 0 10px 0 5px; } .post-footer a.readmore { margin: 0 10px 0 5px; } /* ======================================== Slideshow Header Styles =========================================== */ .clear { clear:both } #gallery { position:relative; height:360px } #gallery a { float:left; position:absolute; } #gallery a img { border:none; } #gallery a.show { z-index:500 } #gallery .caption { z-index:600; background-color:#000; color:#ffffff; height:100px; width:100%; position:absolute; bottom:0; } #gallery .caption .content { margin:5px } #gallery .caption .content h3 { margin:0; padding:0; color:#1DCCEF; } /* ======================================== Miscellaneous Styles =========================================== */ .contact_us_error { color: #FF0000; font-style: italic; } .contact_us_success { color: #0000FF; font-style: italic; } .shopping_cart { color: #FFFFFF } .customer_info { color: #006600; } .comment { color: #000000; } Here is the JS code for my slideshow: function slideShow() { //Set the opacity of all images to 0 $('#gallery a').css({opacity: 0.0}); //Get the first image and display it (set it to full opacity) $('#gallery a:first').css({opacity: 1.0}); //Set the caption background to semi-transparent $('#gallery .caption').css({opacity: 0.7}); //Resize the width of the caption according to the image width $('#gallery .caption').css({width: $('#gallery a').find('img').css('width')}); //Get the caption of the first image from REL attribute and display it $('#gallery .content').html($('#gallery a:first').find('img').attr('rel')) .animate({opacity: 0.7}, 400); //Call the gallery function to run the slideshow, 6000 = change to next image after 6 seconds setInterval('gallery()',6000); } function gallery() { //if no IMGs have the show class, grab the first image var current = ($('#gallery a.show')? $('#gallery a.show') : $('#gallery a:first')); //Get next image, if it reached the end of the slideshow, rotate it back to the first image var next = ((current.next().length) ? ((current.next().hasClass('caption'))? $('#gallery a:first') :current.next()) : $('#gallery a:first')); //Get next image caption var caption = next.find('img').attr('rel'); //Set the fade in effect for the next image, show class has higher z-index next.css({opacity: 0.0}) .addClass('show') .animate({opacity: 1.0}, 1000); //Hide the current image current.animate({opacity: 0.0}, 1000) .removeClass('show'); //Set the opacity to 0 and height to 1px $('#gallery .caption').animate({opacity: 0.0}, { queue:false, duration:0 }).animate({height: '1px'}, { queue:true, duration:300 }); //Animate the caption, opacity to 0.7 and heigth to 100px, a slide up effect $('#gallery .caption').animate({opacity: 0.7},100 ).animate({height: '100px'},500 ); //Display the content $('#gallery .content').html(caption); }
  21. I chose your method #1 and it works perfectly. Thanks for the quick response. I will probably take your last part of advice later one, but for now the client handed me this site and wants it done quickly. Thanks again!
  22. They will be sequential and starting at 1. Below is the part of the form that will be generating the values: <?php $i = 1; foreach($_SESSION['cart'] as $video_id => $x) { ?> <input type="hidden" name="product_id_<?php echo $i; ?>" value="<?php echo $video_id; ?>" /> <?php $i++; } ?>
  23. I am trying to retrieve certain keys of a post array. I am sending a payment form with a dynamic number of product id's. I will never know how many product id's will be sent for each order. When the post array returns the values to my script it returns them as: $_POST['product_id_1'], $_POST['product_id_2'], etc. How would I be able to extract all post array keys that start with "product_id_? Here is what I was thinking earlier, but it doesn't work. $i = 1; foreach ($_POST['product_id_' . $i] as $product) { $productId = $product['product_id_' . $i]; $queryInsert = mysql_query("INSERT INTO video_purchase (video_purchase_purchase_id, video_purchase_video_id) VALUES ($purchaseId, $productId)", $connect) or die(mysql_error()); $i++; }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.