Jump to content

Skipjackrick

Members
  • Posts

    196
  • Joined

  • Last visited

    Never

Everything posted by Skipjackrick

  1. Thanks for the help! Works awesome
  2. I can't alter that format. It comes from the camera exif data. However, I can do this... <?php $date = '1998:03:20 00:10:00'; $dateval = strtotime($date); //this will output "890377200" ?>
  3. I've got a script that outputs the date and time as: 1998:03:20 00:10:00 I want to break apart that format into something like this <?php $month = 03; //get the month from the formatted date above $day = 20; //get the day from the formatted date above $year = 1998; //get the year from the formatted date above echo "You took that picture on $month / $day / $year"; ?> How do I do that?
  4. Sorry...sometimes i don't realize that you guys can't see what I see... I bet that can be irritating...LOL Ok... So it seems to be working sort of... I am now getting more than one row to show up. However only 2 anglers are showing up. Here is what is output Species--------------Angler--------------Team--------------Length--------------Image Red Drum--------PierPressure-------Hawg Wild------------51.00" --------------Image Yellowfin Tuna--------Oz--------------Rockstar--------------44.00" --------------Image Cobia (Ling)-----------Oz--------------Rockstar--------------53.00" --------------Image King Mackerel---------Oz--------------Rockstar--------------55.00" --------------Image Trout--------------------Oz--------------Rockstar--------------31.50" --------------Image However there are several more MAX length with different teams and anglers that aren't being displayed....?? <?php $querySC = "SELECT species_id, team_id, angler, length, image FROM submit s1 WHERE region_id=1 AND length=(SELECT MAX(s2.length) FROM submit s2 WHERE s1.species_id = s2.species_id) "; $resultSC = mysql_query($querySC) or die (mysql_error()); if (mysql_num_rows($resultSC) > 0){ while($row = mysql_fetch_array($resultSC)) { $species_id = $row['species_id']; $angler = $row['angler']; $team_id = $row['team_id']; $length = $row['length']; $image = $row['image']; //get team's name from team table get_team_name($team_id); get_species($species_id); get_angler_handle($angler); $recordsSC .=<<<EOD <tr> <td align='center'><a href='submitted_pics/$image' onclick='return hs.expand(this)' class='highslide' title='Click here to see the $speciesname'>$speciesname</a></td> <td align='center'><a href='anglerprofile.php?anglerid=$angler' title='Find out more about $anglerhandle'>$anglerhandle</a></td> <td align='center'><a href='teampage.php?team_idvar=$team_id&team=$teamname' title='Find out more about $teamname'>$teamname</a></td> <td align='center'>$length"</td> <td align='center'><a href='submitted_pics/$image' onclick='return hs.expand(this)' class='highslide' title='Click here to see the Fish'>Image</a></td> </tr> EOD; } } else { echo ""; } $bonus_footer ="</table>"; $bonus_wars =<<<BONUS $bonus_header $recordsSC $bonus_footer BONUS; print $bonus_wars; ?>
  5. ?? THanks... but still not working for me. But I think I am moving forward. Here is what I've got. I am not sure what the s1 and s2 are meant for but put them in there??? Any help explaining? <?php $querySC = "SELECT species_id, team_id, angler, length, image FROM submit s1 WHERE region_id=1 AND length=(SELECT MAX(s2.length) FROM submit s2 WHERE s1.species_id = s2.species_id)"; "; $resultSC = mysql_query($querySC) or die (mysql_error()); if (mysql_num_rows($resultSC) > 0){ while($row = mysql_fetch_array($resultSC)) { $species_id = $row['species_id']; $angler = $row['angler']; $team_id = $row['team_id']; $length = $row['length']; $image = $row['image']; //get team's name from team table get_team_name($team_id); get_species($species_id); get_angler_handle($angler); $recordsSC .=<<<EOD <tr> <td align='center'><a href='submitted_pics/$image' onclick='return hs.expand(this)' class='highslide' title='Click here to see the $speciesname'>$speciesname</a></td> <td align='center'><a href='anglerprofile.php?anglerid=$angler' title='Find out more about $anglerhandle'>$anglerhandle</a></td> <td align='center'><a href='teampage.php?team_idvar=$team_id&team=$teamname' title='Find out more about $teamname'>$teamname</a></td> <td align='center'>$length"</td> <td align='center'><a href='submitted_pics/$image' onclick='return hs.expand(this)' class='highslide' title='Click here to see the Fish'>Image</a></td> </tr> EOD; } } else { echo ""; } $bonus_footer ="</table>"; $bonus_wars =<<<BONUS $bonus_header $recordsSC $bonus_footer BONUS; print $bonus_wars; ?>
  6. The one row returned is the very last species_id and the length is not the max. Its strange.
  7. I want the max length per species_id
  8. For some reason I am only getting one result when I use the following code. Does anybody know what I am doing wrong? <?php $querySC = "SELECT species_id, team_id, angler, MAX(length), image FROM submit WHERE region_id=1 GROUP BY species_id "; $resultSC = mysql_query($querySC) or die (mysql_error()); if (mysql_num_rows($resultSC) > 0){ while($row = mysql_fetch_array($resultSC)) { $species_id = $row['species_id']; $angler = $row['angler']; $team_id = $row['team_id']; $length = $row['MAX(length)']; $image = $row['image']; //get team's name from team table get_team_name($team_id); get_species($species_id); get_angler_handle($angler); } $recordsSC .=<<<EOD <tr> <td align='center'><a href='submitted_pics/$image' onclick='return hs.expand(this)' class='highslide' title='Click here to see the $speciesname'>$speciesname</a></td> <td align='center'><a href='anglerprofile.php?anglerid=$angler' title='Find out more about $anglerhandle'>$anglerhandle</a></td> <td align='center'><a href='teampage.php?team_idvar=$team_id&team=$teamname' title='Find out more about $teamname'>$teamname</a></td> <td align='center'>$length"</td> </tr> EOD; } else { echo ""; } $bonus_footer ="</table>"; $bonus_wars =<<<BONUS $bonus_header $recordsSC $bonus_footer BONUS; print $bonus_wars; ?>
  9. Nevermind... god I am douche sometimes..
  10. Am I missing something here? <?php $length = 2; $world_record = 1; $anglerId = 2; if ($length > $world_record) { //Update kayak man points $record_kmpoints = "UPDATE anglers SET kayakman_points = kayakman_points + 5 WHERE anglerId=$anglerId"; $wr_kmpoints = mysql_query($record_kmpoints) or exit(mysql_error()); } ?>
  11. So I've got this image script working well for me. But, I'd like to resize the image. What do I use? Here is the bit of code I think needs to be elaborated on but I've included the whole file if needed. <?php // make a unique filename for the uploaded file $uploadFilename = $uploadsDirectory.$now.'_angler'.$anglerId.'_team'.$team.'.jpg'; // now let's move the file to its final and allocate it with the new filename @move_uploaded_file($_FILES[$fieldname]['tmp_name'], $uploadFilename) or error('receiving directory insuffiecient permission', $uploadForm); $image_name = ''.$now.'_angler'.$anglerId.'_team'.$team.'.jpg'; ?> The rest of the file for reference. <?php // filename: upload.processor.php // make a note of the current working directory, relative to root. $directory_self = str_replace(basename($_SERVER['PHP_SELF']), '', $_SERVER['PHP_SELF']); // make a note of the directory that will recieve the uploaded files $uploadsDirectory = $_SERVER['DOCUMENT_ROOT'] . $directory_self . 'submitted_pics/'; // make a note of the location of the upload form in case we need it $uploadForm = 'http://' . $_SERVER['HTTP_HOST'] . $directory_self . 'photo.php'; // name of the fieldname used for the file in the HTML form $fieldname = 'file'; if (!($_FILES[$fieldname]['type'] =='image/pjpeg' OR $_FILES[$fieldname]['type'] =='image/jpeg')) { header("Refresh: 5; URL=addaprofile_photos.php"); echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"'."\n". '"http://www.w3.org/TR/html4/strict.dtd">'."\n\n". '<html lang="en">'."\n". ' <head>'."\n". ' <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">'."\n\n". ' <link rel="stylesheet" type="text/css" href="stylesheet.css">'."\n\n". ' <title>Upload error</title>'."\n\n". ' </head>'."\n\n". ' <body>'."\n\n". ' <div id="Upload">'."\n\n". ' <h1>Error: Only non-progressive JPG file types are accepted</h1>'."\n\n". ' <p>Please Try Again: '."\n\n". ' <span class="red">' . $error . '...</span>'."\n\n". ' The upload form is reloading</p>'."\n\n". ' </div>'."\n\n". '</html>'; exit; } else { // Now let's deal with the upload // possible PHP upload errors $errors = array(1 => 'php.ini max file size exceeded', 2 => 'html form max file size exceeded', 3 => 'file upload was only partial', 4 => 'no file was attached'); // check the upload form was actually submitted else print form isset($_POST['submit']) or error('the upload form is neaded', $uploadForm); // check for standard uploading errors ($_FILES[$fieldname]['error'] == 0) or error($errors[$_FILES[$fieldname]['error']], $uploadForm); // check that the file we are working on really was an HTTP upload @is_uploaded_file($_FILES[$fieldname]['tmp_name']) or error('not an HTTP upload', $uploadForm); // validation... since this is an image upload script we // should run a check to make sure the upload is an image @getimagesize($_FILES[$fieldname]['tmp_name']) or error('only image uploads are allowed', $uploadForm); $now = time(); $anglerId = $_GET['anglerId']; $team = $_GET['team']; // make a unique filename for the uploaded file $uploadFilename = $uploadsDirectory.$now.'_angler'.$anglerId.'_team'.$team.'.jpg'; // now let's move the file to its final and allocate it with the new filename @move_uploaded_file($_FILES[$fieldname]['tmp_name'], $uploadFilename) or error('receiving directory insuffiecient permission', $uploadForm); $image_resolution = 'submitted_pics/'.$now.'_angler'.$anglerId.'_team'.$team.'.jpg'; //Check to make sure the resolution is accurate list($width, $height) = getimagesize($image_resolution); $widthMin = 479; $heightMin = 479; if( ($width < $widthMin) || ($height < $heightMin) ) { $errorMessage = 'The minimum resolution for photos must be 640 x 480 pixels'; $_SESSION['errorCount'] = 1; $_SESSION['errorMessage'] = $errorMessage; header("Location: team_error.php"); exit; } //if an error echo(mysql_error()); $region = $_GET['region']; // make a note of the location of the success page and call the team_id and region_id variables to pass $uploadSuccess = 'http://' . $_SERVER['HTTP_HOST'] . $directory_self . 'exif_check.php?team_id=' . $team . '&region_id=' . $region . ''; // If you got this far, everything has worked and the file has been successfully saved. // We are now going to redirect the client to the success page. header('Location: ' . $uploadSuccess); // make an error handler which will be used if the upload fails function error($error, $location, $seconds = 5) { header("Refresh: $seconds; URL=\"$location\""); echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"'."\n". '"http://www.w3.org/TR/html4/strict.dtd">'."\n\n". '<html lang="en">'."\n". ' <head>'."\n". ' <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">'."\n\n". ' <link rel="stylesheet" type="text/css" href="stylesheet.css">'."\n\n". ' <title>Upload error</title>'."\n\n". ' </head>'."\n\n". ' <body>'."\n\n". ' <div id="Upload">'."\n\n". ' <h1>Upload failure</h1>'."\n\n". ' <p>An error has occured: '."\n\n". ' <span class="red">' . $error . '...</span>'."\n\n". ' The upload form is reloading</p>'."\n\n". ' </div>'."\n\n". '</html>'; exit; } // end error handler } // end if else statement concerning file type ?>
  12. I just read the rules of this forum and then realized I broke the rules... Apologies... I can't figure out how to delete?
  13. I've searched the internet up and down trying to find a photo upload script that is better than what I currently have. I can't find anything that really does what I need. Here is what I am looking for. A script that will allow the user to upload an image from their camera up to 10 MB. Then, Resize the photo to a specified size. And make the file a JPG image. Then, Rename it to a custom name for example <?php // make a note of the directory that will recieve the uploaded files $uploadsDirectory = $_SERVER['DOCUMENT_ROOT'] . $directory_self . 'submitted_pics/'; $now = time(); // make a unique filename for the uploaded file $uploadFilename = $uploadsDirectory.$now.'_angler'.$anglerId.'_team'.$team.'.jpg'; // now move the file to its final and allocate it with the new filename @move_uploaded_file($_FILES[$fieldname]['tmp_name'], $uploadFilename) or error('receiving directory insuffiecient permission', $uploadForm); ?> However, I need the upload script to be able to keep the exif data intact because I use this function later to display important information. <?php $directory = $_SERVER['DOCUMENT_ROOT']; $exif_data = exif_read_data ('' . $directory . '/submitted_pics/' . $image . ''); ?> Do any of you guys know of a decent script that I could get some ideas from? I've been reading php.net on this stuff and can't seem to get a good output from anything I do. Any help is greatly appreciated.
  14. I continue to get this error below. However its at random. I believe it has to do with the user corrupting the exif data with an image resizing program etc. Is there a way to notify the user that there has been an error when the exif data can't be read? How would one go about writing the code for that? This is how I am calling to read the data. However when it can't????? The program just goes to a php error screen. I would like to take the user to a custom screen. Something like this...However, I dont know the exact syntax. <?php $directory = $_SERVER['DOCUMENT_ROOT']; $exif_data = exif_read_data ('' . $directory . '/submitted_pics/' . $image . ''); if ( $exif_data == error ) { header ("location: errorpage.php"); exit; } ?> In case you wanted to look at the errors I get.... [04-Feb-2010 05:19:24] PHP Warning: exif_read_data(1265260748_angler280_team69.jpg) [<a href='exif_read_data#error_ifd'>exif_read_data</a>]: Process tag(x0000=UndefinedTa): Illegal format code 0x0000, suppose BYTE in /home/extremf3/public_html/KW10/submission_submit.php on line 132 [04-Feb-2010 05:19:24] PHP Warning: exif_read_data(1265260748_angler280_team69.jpg) [<a href='exif_read_data#error_ifd'>exif_read_data</a>]: Process tag(x0000=UndefinedTa): Illegal pointer offset(x6C656374 + x4C472045 = xB8AC83B9 > x0137) in /home/extremf3/public_html/KW10/submission_submit.php on line 132 [04-Feb-2010 05:19:24] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/extremf3/public_html/KW10/submission_submit.php:132) in /home/extremf3/public_html/KW10/submission_submit.php on line 258
  15. So, I am trying to get the exif data to be displayed under each image I have saved. The image information is stored on the DB but i can't seem to figure out how to get this to work dynamically. Any Ideas? This is what I've got but obviously it doesn't work. <?php $directory = $_SERVER['DOCUMENT_ROOT']; $query="SELECT image FROM photos ORDER BY image_id DESC"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_array($result)) { $image = $row['image']; $kayakwars_details .=<<<EOD <tr> <td><img src='submitted_pics/$image' alt='$image' /><br /> $exif_data = exif_read_data ('' . $directory . '/submitted_pics/$image'); $emake =$exif_data['Make']; $emodel = $exif_data['Model']; $eexposuretime = $exif_data['ExposureTime']; $efnumber = $exif_data['FNumber']; $eiso = $exif_data['ISOSpeedRatings']; $edate = $exif_data['DateTime']; echo "Camera: $emake <br />Model: $emodel <br />Exposure: $eexposuretime <br />Focal Length: $efnumber <br />ISO: $eiso <br />Date and Time: $edate "; </td> </tr> EOD; } ?>
  16. Ah...I used strtotime() and its works perfect. Thanks!
  17. Doesn't that function return something like this? <?php $start= "2010:01:01 00:00:00"; $strtotime = strtotime($start); echo "$strtotime"; // Out put is January 1st 2010 edit: I was incorrect....it actually outputs this 1262329200 ?> .... but I get your drift. Does anybody have an example of how I could compare dates correctly?
  18. So I am trying to keep these guys from uploading old photos and saying they are fresh. I've got this neat php function that I am using to do so. However I can't seem to get it to work. Can you guys review my code and tell me what's up? <?php $directory = $_SERVER['DOCUMENT_ROOT']; $image = "example.jpg"; $exif_data = exif_read_data ('' . $directory . '/submitted_pics/' . $image . ''); $edate = $exif_data['DateTime']; $start= "2010:01:01 00:00:01"; //FYI $edate outputs in this format 2010:01:01 00:00:01 if( $edate < $start) { $errorCount += 1; if( $errorCount > 1 ) {$errorMessage .= ', '; } $errorMessage .= 'Sorry, the meta data, Date and Time for the image you have submitted is not within the specified duration. Please be sure that the time and date are accurately set on your camera.'; } ?>
  19. DOH! Why doesn't my text editor highlight the text differently!!!??????? Man that was bugging me.
  20. Do any of you see a problem with this? For some reason I continue to get an error unexpected '{' when i add the following code. <?php if( $anglerId != $_SESSION['anglerId'] OR !isset($_GET['currentpage']) { //Update profile views $prfviews = "UPDATE anglers SET profile_views = profile_views + 1 WHERE anglerId = $anglerId "; $prfview = mysql_query($prfviews) or exit(mysql_error()); } ?>
  21. Ah, you've got to put the book mark at the end This works. <?php echo " <li class='next'><a href='{$_SERVER['PHP_SELF']}?currentpage=1#article5'>First <<</a></li> "; ?>
  22. I think you are trying to do this? <?php $resultfav = mysql_query("SELECT * FROM favorites WHERE owner='$username' "); $result = mysql_query($resultfav) or die(mysql_error()); echo "<a href='{$result['item_name']}' >{$result['board']}</a>"; ?>
  23. I've got an issue. I need a typical html bookmark. Example, <a href="index.php#article5">See Article 5</a> <!-- Then somewhere way down the page I have this ---> <a name="article5"></a> When I write this in PHP I get an error as expected. <?php echo " <li class='next'><a href='{$_SERVER['PHP_SELF']}#article5?currentpage=1'>First <<</a></li> "; ?> Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /development/index.php on line 2 Does anyone know how to direct the user to that article? Or how to properly use a bookmark using PHP?
  24. Dang, I found it...too quick to post..... However, I am thankful that you noticed my appending variable.. I didn't mean to do that. The answer.... I was missing a semicolon below..... $team = mysql_fetch_assoc($result)
  25. Here is my output when the if statement is true echo "$team"; is displayed like this N
×
×
  • 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.