Jump to content

StanLytle

Members
  • Posts

    40
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

StanLytle's Achievements

Member

Member (2/5)

0

Reputation

  1. Reading the $exif['EXIF']['ExposureTime'] values from digital images returns all sorts of numbers and improper fractions. In trying to display proper fractions, I came up with the following. Is there a better way. ANd I see that this isn't going to work if the number isn't a fraction (contains the /): /* set value to $exposure for testing*/ $exposure = "10/3200"; $pos = strpos($exposure, '/'); $num = substr($exposure, 0, $pos); $pos = $pos + 1; $denom = substr($exposure, $pos); $dec = $num / $denom; $newdenom = 1 / $dec; $roundnewdenom = number_format($newdenom, 0); $newexposure = "1/" . $roundnewdenom; /* print $newexposure to check output */ echo "$newexposure<br/>"; Thanks, Stan
  2. Some success! What was missing were foreach statements. At least thats what made it work. I can extract the data, even though the data isn't output in the format I want: $exif = exif_read_data($File, 'IFD0'); if ($exif == true) { $exif = exif_read_data($File, 0, true); foreach ($exif as $key => $section) { foreach ($section as $name => $val) { $model = $exif['IFD0']['Software']; $iso = $exif['EXIF']['ISOSpeedRatings']; $exposure = $exif['EXIF']['ExposureTime'].' sec'; $fstop = $exif['COMPUTED']['ApertureFNumber']; $focallength = intval($exif['EXIF']['FocalLength']).' mm'; $focallength35mm = intval($exif['EXIF']['FocalLengthIn35mmFilm']).' mm'; } } if ($model == "K10D ") { $model = "Pentax K10D"; } $PhotoExif = $model . ", ISO " . $iso . ", " . $exposure. ", " . $fstop. ", " . $focallength; } Now the problem is that I can't change the value of $model from "K10D space" to "Pentax K10D".
  3. And I tried removing the single quotes. Still doesn't work: $exif = exif_read_data($File, 'IFD0'); if ($exif == true) { $exif = exif_read_data($File, 0, true); foreach ($exif as $key => $section) { $model = $exif['IFD0']['Model']; $iso = $exif['EXIF']['ISOSpeedRatings']; $exposure = $exif['EXIF']['ExposureTime'].' sec'; $fstop = $exif['COMPUTED']['ApertureFNumber']; $focallength = intval($exif['EXIF']['FocalLength']).' mm'; $focallength35mm = intval($exif['EXIF']['FocalLengthIn35mmFilm']).' mm'; } echo "Model: $model<br/>"; echo "ISO: $iso<br/>"; echo "Shutter Speed: $exposure<br/>"; echo "f Stop: $fstop<br/>"; echo "Focal Length: $focallength<br/>"; echo "Focal Length 35mm: $focallength35mm<br/>"; $PhotoExif = $model . ", ISO " . $iso . ", " . $exposure. ", " . $fstop. ", " . $focallength; } else { $PhotoExif = ""; } Thanks
  4. I'm not sure if I did what you suggested correctly, but it didn't work either. Here's what I tried: $exif = exif_read_data('$_FILES[File][$File]', 'IFD0'); if ($exif == true) { $exif = exif_read_data('$_FILES[File][$File]', 0, true); foreach ($exif as $key => $section) { $model = $exif['IFD0']['Model']; $iso = $exif['EXIF']['ISOSpeedRatings']; $exposure = $exif['EXIF']['ExposureTime'].' sec'; $fstop = $exif['COMPUTED']['ApertureFNumber']; $focallength = intval($exif['EXIF']['FocalLength']).' mm'; $focallength35mm = intval($exif['EXIF']['FocalLengthIn35mmFilm']).' mm'; } echo "Model: $model<br/>"; echo "ISO: $iso<br/>"; echo "Shutter Speed: $exposure<br/>"; echo "f Stop: $fstop<br/>"; echo "Focal Length: $focallength<br/>"; echo "Focal Length 35mm: $focallength35mm<br/>"; $PhotoExif = $model . ", ISO " . $iso . ", " . $exposure. ", " . $fstop. ", " . $focallength; } else { $PhotoExif = ""; } Thanks
  5. When images are uploaded, they are given a random file name, such as /tmp/php7cFxpG. How do I get this file name to work with exif_read_data? Here's what I have that doesn't work: $exif = exif_read_data('$File', 'IFD0'); if ($exif == true) { $exif = exif_read_data('$File', 0, true); foreach ($exif as $key => $section) { $model = $exif['IFD0']['Model']; $iso = $exif['EXIF']['ISOSpeedRatings']; $exposure = $exif['EXIF']['ExposureTime'].' sec'; $fstop = $exif['COMPUTED']['ApertureFNumber']; $focallength = intval($exif['EXIF']['FocalLength']).' mm'; $focallength35mm = intval($exif['EXIF']['FocalLengthIn35mmFilm']).' mm'; } echo "Model: $model<br/>"; echo "ISO: $iso<br/>"; echo "Shutter Speed: $exposure<br/>"; echo "f Stop: $fstop<br/>"; echo "Focal Length: $focallength<br/>"; echo "Focal Length 35mm: $focallength35mm<br/>"; $PhotoExif = $model . ", ISO " . $iso . ", " . $exposure. ", " . $fstop. ", " . $focallength; } else { $PhotoExif = ""; } Thanks
  6. Yes. With some help (thanks guys) I was able to output (view) the contents of the table by the cutoff time I wanted. See: http://www.phpfreaks.com/forums/index.php/topic,243819.0.html for reference. Now I want to use the data, find a specific person, without displaying the table. Stan
  7. What I'd like to do, is look into a table, to see if a person has had more than x number of rejections (ie: 10), in the past 10 days. I'm not getting anymore mySQL errors, but this just outputs "You can upload pictures" over and over and over again. Any help appreciated. $RejectCutOffTime = strtotime('-10 days'); $query = "SELECT UserID, COUNT(UserID) FROM Rejections WHERE (Date > '$RejectCutOffTime') GROUP BY UserID ORDER BY UserID"; $result = mysql_query($query) or die(mysql_error()); while(list($id, $ct) = mysql_fetch_row($result)) { if (($SessionUserID == $id) AND ($ct > '10')) { print "You have too many rejections to upload pictures"; } else { print "You can upload pictures"; } }
  8. I went with $CutOffTime = strtotime('-10 days'), and it worked just as I wanted it to. Thank you for all of your help. Stan
  9. I think that you are onto something. $CutOffTime is -864000, but $CurrentTime is blank (no numbers, not even 0). So $CurrentTime must not have any vlaue. How do I get the current time into $CurrentTime?
  10. The table outputs, the structure is fine, it counts and groups correctly, but it will not output only the most recent days as set by $CutOffTime. It outputs the entire table, from day 1. I want to limit the output to only whatever number of days that I specify. Stan
  11. No matter what I try, I can't get the table that is output to be limited by the cut off time (ie: last 10 days). I finally got rid of all the mySQL errors, but now I'm stumped. Any suggestions appreciated. $CutOffTime = strtotime('-14400 minutes', $CurrentTime); $query = "SELECT UserID, Name, COUNT(UserID) FROM Rejections WHERE (Date > '$CutOffTime') GROUP BY UserID ORDER BY UserID"; $result = mysql_query($query) or die(mysql_error()); while(list($id, $name, $ct) = mysql_fetch_row($result)) { echo "<tr>"; echo "<td>$id</td>"; echo "<td>$name</td>"; echo "<td>$ct</td>"; echo "</tr>"; }
  12. Thanks. I didn't know it would have to be output as an array.
  13. This looks simple, but it doesn't work. I get no output what so ever, not even an error message. The page does connect to the database, I've tried existing queries that do work. $NewPhotoID is valid, it contains a value, I've checked. Field names and table name are correct and spelled correctly. $sql = "SELECT FileName FROM Photos WHERE PhotoID = $NewPhotoID"; $result = mysql_query ($sql); print $FileName; My server is running: php version 5.2.6 mysql version 5.0.51a-community
×
×
  • 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.