1. ### TO DO: Check if source directory is given as parameter, exit status 1 on error 2. ### TO DO: Check if source is a directory, exit istatus 2 on error 3. 4. # Check the source directory is absolute or relative-to-home, exit on error 5. echo "$1" | grep "^/" > /dev/null 6. if [ "$?" -ne 0 ] 7. then 8. echo "Source must be an absolute or relative-to-home path" 9. exit 1 10. else 11. echo "Has to be relative path" 12. exit 2 13. fi 14. 15. if [ "$?" -le 0 ] 16. then 17. echo "Checking if it is relative" 18. exit 3 19. fi 20. 21. # Set the destination directory to ~/public_html if not given as argument 22. test "$#" -lt 2 && set $1 ~/public_html 23. 24. # Create the destination directory if it does not exist 25. # Exit with a status code 5 if directory cannot be created 26. test -e $2 || mkdir $2 || exit 5 27. 28. ## TO DO: Create the thumbnail directory if it does not exist 29. mkdir -p ~public_html/picreporter/thumbnail 30. ### TO DO: Determine the report file name based on the source directory name and current date 31. ### The report name and thumbnail directory must follow this pattern: source-%d-%m 32. ### for example, for pictures in /home/you/pictures, the file name will be: pictures-%d-%m 33. ### HINT: Use sed to extract the directory name from the path and combine it with date command output 34. 35. # Create the beginning of the summary page and write it to the summary file 36. ### TO DO: Correct the report file name below 37. cat << TOP > $2/picreporter.html 38. <?xml version="1.0" encoding="utf-8"?> 39. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 40. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US"> 41. <head> 42. <title>Exif Report Page</title> 43. 44. <style type="text/css"> 45. ### TO DO: Set the font typeface for the entire report page to Times New Roman 46. body {font-family: Times New Roman;} 47. </style> 48. </head> 49. <body> 50. <h2>Exif Report Page</h2> 51. TOP 52. 53. ### TO DO: Add the path to the source directory to the report 54. ### TO DO: Add current date/time to the report 55. echo `date` 56. ### TO DO: Start an HTML table 57. echo <table> 58. ### TO DO: Finish the $() below - the command will obtain a list of .jpg files in the source directory 59. for picture in $() 60. do 61. ### TO DO: Correct the path and report file name below 62. echo "<tr>" >> $2/picreporter.html 63. 64. ### TO DO: Create an HTML cell containing a thumbnail 218 pixels wide 65. ### HINT: Find out how to use the convert command 66. 67. ### TO DO: Create an HTML cell containing output of the exiftool command 68. ### TO DO: End an HTML row 69. done 70. 71. ### TO DO: Finish an HTML table 72. echo </table> 73. ### TO DO: Add the summary line to the report (how many images were processed) 74. ### TO DO: Determine the report file name based on the source directory name and current date 75. ### TO DO: Add the W3C XHTML Validator link and icon to the report 76. echo "<p>" >> $2 77. echo " <a href=\"http://validator.w3.org/check?uri=referer\"><img" >> $2 78. echo " src=\"http://www.w3.org/Icons/valid-xhtml10\"" >> $2 79. echo " alt=\"Valid XHTML 1.0 Transitional\" height=\"31\" width=\"88\" />" >> $2 80. echo "</a>" >> $2 81. echo "</p>" >> $2 82. 83. ### TO DO: Add the W3C CSS Validator link and icon to the report 84. echo "<p>" >> $2 85. echo " <a href=\"http://jigsaw.w3.org/css-validator/check/referer\">" >> $2 86. echo " <img style=\"border:0;width:88px;height:31px\"" >> $2 87. echo " src=\"http://jigsaw.w3.org/css-validator/images/vcss\"" >> $2 88. echo " alt=\"Valid CSS!\" />" >> $2 89. echo " </a>" >> $2 90. echo "</p>" >> $2 91. ### TO DO: Finish the HTML page 92. echo </html> 93. ### TO DO: Finish the output line to the console 94. echo