changeset 9 | ebd7003e73c6 |
parent 2 | 88c954d2846c |
child 11 | 3c4304fae21e |
8:8490ce0cdd8c | 9:ebd7003e73c6 |
---|---|
34 if ( preg_match('/^[0-9]+$/', $page->page_id) ) |
34 if ( preg_match('/^[0-9]+$/', $page->page_id) ) |
35 { |
35 { |
36 $img_id = intval($page->page_id); |
36 $img_id = intval($page->page_id); |
37 if ( !$img_id ) |
37 if ( !$img_id ) |
38 return false; |
38 return false; |
39 $q = $db->sql_query('SELECT img_id, img_title, img_desc, print_sizes, img_time_upload, img_time_mod, folder_parent FROM '.table_prefix.'gallery WHERE img_id=' . $img_id . ';'); |
39 $q = $db->sql_query('SELECT img_id, img_title, img_desc, print_sizes, img_time_upload, img_time_mod, img_filename, folder_parent FROM '.table_prefix.'gallery WHERE img_id=' . $img_id . ';'); |
40 if ( !$q ) |
40 if ( !$q ) |
41 $db->_die(); |
41 $db->_die(); |
42 } |
42 } |
43 else |
43 else |
44 { |
44 { |
59 } |
59 } |
60 unset($folder); |
60 unset($folder); |
61 |
61 |
62 $folders = array_reverse($folders); |
62 $folders = array_reverse($folders); |
63 // This is one of the best MySQL tricks on the market. We're going to reverse-travel a folder path using LEFT JOIN and the incredible power of metacoded SQL |
63 // This is one of the best MySQL tricks on the market. We're going to reverse-travel a folder path using LEFT JOIN and the incredible power of metacoded SQL |
64 $sql = 'SELECT g0.img_id, g0.img_title, g0.img_desc, g0.print_sizes, g0.img_time_upload, g0.img_time_mod, g0.folder_parent FROM '.table_prefix.'gallery AS g0'; |
64 $sql = 'SELECT g0.img_id, g0.img_title, g0.img_desc, g0.print_sizes, g0.img_time_upload, g0.img_time_mod, g0.img_filename, g0.folder_parent FROM '.table_prefix.'gallery AS g0'; |
65 $where = "\n " . 'WHERE g0.img_title=\'' . $db->escape($folders[0]) . '\''; |
65 $where = "\n " . 'WHERE g0.img_title=\'' . $db->escape($folders[0]) . '\''; |
66 foreach ( $folders as $i => $folder ) |
66 foreach ( $folders as $i => $folder ) |
67 { |
67 { |
68 if ( $i == 0 ) |
68 if ( $i == 0 ) |
69 continue; |
69 continue; |
255 <table border="0" cellspacing="1" cellpadding="3">'; |
255 <table border="0" cellspacing="1" cellpadding="3">'; |
256 |
256 |
257 // By the time I got to this point, it was 1:32AM (I was on vacation) and my 5-hour playlist on my iPod had been around about 3 times today. |
257 // By the time I got to this point, it was 1:32AM (I was on vacation) and my 5-hour playlist on my iPod had been around about 3 times today. |
258 // So I'm glad this is like the last thing on the list tonight. |
258 // So I'm glad this is like the last thing on the list tonight. |
259 |
259 |
260 $ext = get_file_extension($row['img_filename']); |
|
261 $ext = strtoupper($ext); |
|
262 |
|
260 echo '<tr><th colspan="2">Image details</th></tr>'; |
263 echo '<tr><th colspan="2">Image details</th></tr>'; |
261 echo '<tr><td class="row2">Uploaded:</td><td class="row1">' . date('F d, Y h:i a', $row['img_time_upload']) . '</td></tr>'; |
264 echo '<tr><td class="row2">Uploaded:</td><td class="row1">' . date('F d, Y h:i a', $row['img_time_upload']) . '</td></tr>'; |
262 echo '<tr><td class="row2">Last modified:</td><td class="row1">' . date('F d, Y h:i a', $row['img_time_mod']) . '</td></tr>'; |
265 echo '<tr><td class="row2">Last modified:</td><td class="row1">' . date('F d, Y h:i a', $row['img_time_mod']) . '</td></tr>'; |
266 echo '<tr><td class="row2">Original format:</td><td class="row1">' . $ext . '</td></tr>'; |
|
267 echo '<tr><td class="row3" colspan="2" style="text-align: center;"><a href="' . makeUrlNS('Special', 'GalleryFetcher/full/' . $img_id, 'download', 'true') . '">Download image</a></td></tr>'; |
|
263 |
268 |
264 echo '</table></div>'; |
269 echo '</table></div>'; |
265 |
270 |
266 $template->footer(); |
271 $template->footer(); |
267 |
272 |