Photo.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748
  1. <?php
  2. ###
  3. # @name Photo Module
  4. # @author Tobias Reich
  5. # @copyright 2014 by Tobias Reich
  6. ###
  7. if (!defined('LYCHEE')) exit('Error: Direct access is not allowed!');
  8. class Photo extends Module {
  9. private $database = null;
  10. private $settings = null;
  11. private $photoIDs = null;
  12. private $allowedTypes = [
  13. IMAGETYPE_JPEG,
  14. IMAGETYPE_GIF,
  15. IMAGETYPE_PNG
  16. ];
  17. private $validExtensions = [
  18. '.jpg',
  19. '.jpeg',
  20. '.png',
  21. '.gif'
  22. ];
  23. public function __construct($database, $plugins, $settings, $photoIDs) {
  24. # Init vars
  25. $this->database = $database;
  26. $this->plugins = $plugins;
  27. $this->settings = $settings;
  28. $this->photoIDs = $photoIDs;
  29. return true;
  30. }
  31. public function add($files, $albumID, $description = '', $tags = '') {
  32. # Check dependencies
  33. $this->dependencies(isset($this->database));
  34. # Call plugins
  35. $this->plugins(__METHOD__, 0, func_get_args());
  36. switch($albumID) {
  37. case 's':
  38. # s for public (share)
  39. $public = 1;
  40. $star = 0;
  41. $albumID = 0;
  42. break;
  43. case 'f':
  44. # f for starred (fav)
  45. $star = 1;
  46. $public = 0;
  47. $albumID = 0;
  48. break;
  49. default:
  50. $star = 0;
  51. $public = 0;
  52. break;
  53. }
  54. foreach ($files as $file) {
  55. # Verify extension
  56. $extension = $this->getExtension($file['name']);
  57. if (!in_array(strtolower($extension), $this->validExtensions, true)) continue;
  58. # Verify image
  59. $type = @exif_imagetype($file['tmp_name']);
  60. if (!in_array($type, $this->allowedTypes, true)) continue;
  61. # Generate id
  62. $id = str_replace('.', '', microtime(true));
  63. while(strlen($id)<14) $id .= 0;
  64. $tmp_name = $file['tmp_name'];
  65. $photo_name = md5($id) . $extension;
  66. $path = LYCHEE_UPLOADS_BIG . $photo_name;
  67. # Import if not uploaded via web
  68. if (!is_uploaded_file($tmp_name)) {
  69. if (!@copy($tmp_name, $path)) exit('Error: Could not copy photo to uploads!');
  70. else @unlink($tmp_name);
  71. } else {
  72. if (!@move_uploaded_file($tmp_name, $path)) exit('Error: Could not move photo to uploads!');
  73. }
  74. # Read infos
  75. $info = $this->getInfo($path);
  76. # Use title of file if IPTC title missing
  77. if ($info['title']==='') $info['title'] = mysqli_real_escape_string($this->database, substr(basename($file['name'], ".$extension"), 0, 30));
  78. # Use description parameter if set
  79. if ($description==='') $description = $info['description'];
  80. # Set orientation based on EXIF data
  81. if ($file['type']==='image/jpeg'&&isset($info['orientation'])&&$info['orientation']!==''&&isset($info['width'])&&isset($info['height'])) {
  82. if (!$this->adjustFile($path, $info)) exit('Error: Could not adjust photo!');
  83. }
  84. # Set original date
  85. if ($info['takestamp']!=='') @touch($path, $info['takestamp']);
  86. # Create Thumb
  87. if (!$this->createThumb($path, $photo_name)) exit('Error: Could not create thumbnail for photo!');
  88. # Save to DB
  89. $query = "INSERT INTO lychee_photos (id, title, url, description, tags, type, width, height, size, iso, aperture, make, model, shutter, focal, takestamp, thumbUrl, album, public, star)
  90. VALUES (
  91. '" . $id . "',
  92. '" . $info['title'] . "',
  93. '" . $photo_name . "',
  94. '" . $description . "',
  95. '" . $tags . "',
  96. '" . $info['type'] . "',
  97. '" . $info['width'] . "',
  98. '" . $info['height'] . "',
  99. '" . $info['size'] . "',
  100. '" . $info['iso'] . "',
  101. '" . $info['aperture'] . "',
  102. '" . $info['make'] . "',
  103. '" . $info['model'] . "',
  104. '" . $info['shutter'] . "',
  105. '" . $info['focal'] . "',
  106. '" . $info['takestamp'] . "',
  107. '" . md5($id) . ".jpeg',
  108. '" . $albumID . "',
  109. '" . $public . "',
  110. '" . $star . "');";
  111. $result = $this->database->query($query);
  112. if (!$result) exit('Error: Could not save photo in database!');
  113. }
  114. # Call plugins
  115. $this->plugins(__METHOD__, 1, func_get_args());
  116. return true;
  117. }
  118. private function createThumb($url, $filename, $width = 200, $height = 200) {
  119. # Check dependencies
  120. $this->dependencies(isset($this->settings, $url, $filename));
  121. # Call plugins
  122. $this->plugins(__METHOD__, 0, func_get_args());
  123. $info = getimagesize($url);
  124. $photoName = explode(".", $filename);
  125. $newUrl = LYCHEE_UPLOADS_THUMB . $photoName[0] . '.jpeg';
  126. $newUrl2x = LYCHEE_UPLOADS_THUMB . $photoName[0] . '@2x.jpeg';
  127. # create thumbnails with Imagick
  128. if(extension_loaded('imagick')) {
  129. # Read image
  130. $thumb = new Imagick();
  131. $thumb->readImage($url);
  132. $thumb->setImageCompressionQuality($this->settings['thumbQuality']);
  133. $thumb->setImageFormat('jpeg');
  134. # Copy image for 2nd thumb version
  135. $thumb2x = clone $thumb;
  136. # Create 1st version
  137. $thumb->cropThumbnailImage($width, $height);
  138. $thumb->writeImage($newUrl);
  139. $thumb->clear();
  140. $thumb->destroy();
  141. # Create 2nd version
  142. $thumb2x->cropThumbnailImage($width*2, $height*2);
  143. $thumb2x->writeImage($newUrl2x);
  144. $thumb2x->clear();
  145. $thumb2x->destroy();
  146. } else {
  147. # Set position and size
  148. $thumb = imagecreatetruecolor($width, $height);
  149. $thumb2x = imagecreatetruecolor($width*2, $height*2);
  150. if ($info[0]<$info[1]) {
  151. $newSize = $info[0];
  152. $startWidth = 0;
  153. $startHeight = $info[1]/2 - $info[0]/2;
  154. } else {
  155. $newSize = $info[1];
  156. $startWidth = $info[0]/2 - $info[1]/2;
  157. $startHeight = 0;
  158. }
  159. # Fallback for older version
  160. if ($info['mime']==='image/webp'&&floatval(phpversion())<5.5) return false;
  161. # Create new image
  162. switch($info['mime']) {
  163. case 'image/jpeg': $sourceImg = imagecreatefromjpeg($url); break;
  164. case 'image/png': $sourceImg = imagecreatefrompng($url); break;
  165. case 'image/gif': $sourceImg = imagecreatefromgif($url); break;
  166. case 'image/webp': $sourceImg = imagecreatefromwebp($url); break;
  167. default: return false; break;
  168. }
  169. # Create thumb
  170. fastimagecopyresampled($thumb, $sourceImg, 0, 0, $startWidth, $startHeight, $width, $height, $newSize, $newSize);
  171. imagejpeg($thumb, $newUrl, $this->settings['thumbQuality']);
  172. imagedestroy($thumb);
  173. # Create retina thumb
  174. fastimagecopyresampled($thumb2x, $sourceImg, 0, 0, $startWidth, $startHeight, $width*2, $height*2, $newSize, $newSize);
  175. imagejpeg($thumb2x, $newUrl2x, $this->settings['thumbQuality']);
  176. imagedestroy($thumb2x);
  177. # Free memory
  178. imagedestroy($sourceImg);
  179. }
  180. # Call plugins
  181. $this->plugins(__METHOD__, 1, func_get_args());
  182. return true;
  183. }
  184. private function adjustFile($path, $info) {
  185. # Check dependencies
  186. $this->dependencies(isset($path, $info));
  187. # Call plugins
  188. $this->plugins(__METHOD__, 0, func_get_args());
  189. if (extension_loaded('imagick')) {
  190. $rotateImage = 0;
  191. switch ($info['orientation']) {
  192. case 3:
  193. $rotateImage = 180;
  194. $imageOrientation = 1;
  195. break;
  196. case 6:
  197. $rotateImage = 90;
  198. $imageOrientation = 1;
  199. break;
  200. case 8:
  201. $rotateImage = 270;
  202. $imageOrientation = 1;
  203. break;
  204. }
  205. if ($rotateImage!==0) {
  206. $image = new Imagick();
  207. $image->readImage($path);
  208. $image->rotateImage(new ImagickPixel(), $rotateImage);
  209. $image->setImageOrientation($imageOrientation);
  210. $image->writeImage($path);
  211. $image->clear();
  212. $image->destroy();
  213. }
  214. } else {
  215. $newWidth = $info['width'];
  216. $newHeight = $info['height'];
  217. $process = false;
  218. $sourceImg = imagecreatefromjpeg($path);
  219. switch ($info['orientation']) {
  220. case 2:
  221. # mirror
  222. # not yet implemented
  223. break;
  224. case 3:
  225. $process = true;
  226. $sourceImg = imagerotate($sourceImg, -180, 0);
  227. break;
  228. case 4:
  229. # rotate 180 and mirror
  230. # not yet implemented
  231. break;
  232. case 5:
  233. # rotate 90 and mirror
  234. # not yet implemented
  235. break;
  236. case 6:
  237. $process = true;
  238. $sourceImg = imagerotate($sourceImg, -90, 0);
  239. $newWidth = $info['height'];
  240. $newHeight = $info['width'];
  241. break;
  242. case 7:
  243. # rotate -90 and mirror
  244. # not yet implemented
  245. break;
  246. case 8:
  247. $process = true;
  248. $sourceImg = imagerotate($sourceImg, 90, 0);
  249. $newWidth = $info['height'];
  250. $newHeight = $info['width'];
  251. break;
  252. }
  253. # Need to adjust photo?
  254. if ($process===true) {
  255. # Recreate photo
  256. $newSourceImg = imagecreatetruecolor($newWidth, $newHeight);
  257. imagecopyresampled($newSourceImg, $sourceImg, 0, 0, 0, 0, $newWidth, $newHeight, $newWidth, $newHeight);
  258. imagejpeg($newSourceImg, $path, 100);
  259. # Free memory
  260. imagedestroy($sourceImg);
  261. imagedestroy($newSourceImg);
  262. }
  263. }
  264. # Call plugins
  265. $this->plugins(__METHOD__, 1, func_get_args());
  266. return true;
  267. }
  268. public function get($albumID) {
  269. # Check dependencies
  270. $this->dependencies(isset($this->database, $this->photoIDs));
  271. # Call plugins
  272. $this->plugins(__METHOD__, 0, func_get_args());
  273. # Get photo
  274. $photos = $this->database->query("SELECT * FROM lychee_photos WHERE id = '$this->photoIDs' LIMIT 1;");
  275. $photo = $photos->fetch_assoc();
  276. # Parse photo
  277. $photo['sysdate'] = date('d M. Y', substr($photo['id'], 0, -4));
  278. if (strlen($photo['takestamp'])>1) $photo['takedate'] = date('d M. Y', $photo['takestamp']);
  279. if ($albumID!='false') {
  280. if ($photo['album']!=0) {
  281. # Get album
  282. $albums = $this->database->query("SELECT public FROM lychee_albums WHERE id = '" . $photo['album'] . " LIMIT 1';");
  283. $album = $albums->fetch_assoc();
  284. # Parse album
  285. $photo['public'] = ($album['public']=='1' ? '2' : $photo['public']);
  286. }
  287. $photo['original_album'] = $photo['album'];
  288. $photo['album'] = $albumID;
  289. }
  290. # Call plugins
  291. $this->plugins(__METHOD__, 1, func_get_args());
  292. return $photo;
  293. }
  294. private function getInfo($url) {
  295. # Check dependencies
  296. $this->dependencies(isset($this->database, $url));
  297. # Call plugins
  298. $this->plugins(__METHOD__, 0, func_get_args());
  299. $iptcArray = array();
  300. $info = getimagesize($url, $iptcArray);
  301. # General information
  302. $return['type'] = $info['mime'];
  303. $return['width'] = $info[0];
  304. $return['height'] = $info[1];
  305. # Size
  306. $size = filesize($url)/1024;
  307. if ($size>=1024) $return['size'] = round($size/1024, 1) . ' MB';
  308. else $return['size'] = round($size, 1) . ' KB';
  309. # IPTC Metadata Fallback
  310. $return['title'] = '';
  311. $return['description'] = '';
  312. # IPTC Metadata
  313. if(isset($iptcArray['APP13'])) {
  314. $iptcInfo = iptcparse($iptcArray['APP13']);
  315. if (is_array($iptcInfo)) {
  316. $temp = @$iptcInfo['2#105'][0];
  317. if (isset($temp)&&strlen($temp)>0) $return['title'] = $temp;
  318. $temp = @$iptcInfo['2#120'][0];
  319. if (isset($temp)&&strlen($temp)>0) $return['description'] = $temp;
  320. }
  321. }
  322. # EXIF Metadata Fallback
  323. $return['orientation'] = '';
  324. $return['iso'] = '';
  325. $return['aperture'] = '';
  326. $return['make'] = '';
  327. $return['model'] = '';
  328. $return['shutter'] = '';
  329. $return['focal'] = '';
  330. $return['takestamp'] = 0;
  331. # Read EXIF
  332. if ($info['mime']=='image/jpeg') $exif = @exif_read_data($url, 'EXIF', 0);
  333. else $exif = false;
  334. # EXIF Metadata
  335. if ($exif!==false) {
  336. if (isset($exif['Orientation'])) $return['orientation'] = $exif['Orientation'];
  337. else if (isset($exif['IFD0']['Orientation'])) $return['orientation'] = $exif['IFD0']['Orientation'];
  338. $temp = @$exif['ISOSpeedRatings'];
  339. if (isset($temp)) $return['iso'] = $temp;
  340. $temp = @$exif['COMPUTED']['ApertureFNumber'];
  341. if (isset($temp)) $return['aperture'] = $temp;
  342. $temp = @$exif['Make'];
  343. if (isset($temp)) $return['make'] = trim($temp);
  344. $temp = @$exif['Model'];
  345. if (isset($temp)) $return['model'] = trim($temp);
  346. $temp = @$exif['ExposureTime'];
  347. if (isset($temp)) $return['shutter'] = $exif['ExposureTime'] . ' Sec.';
  348. $temp = @$exif['FocalLength'];
  349. if (isset($temp)) $return['focal'] = ($temp/1) . ' mm';
  350. $temp = @$exif['DateTimeOriginal'];
  351. if (isset($temp)) $return['takestamp'] = strtotime($temp);
  352. }
  353. # Security
  354. foreach(array_keys($return) as $key) $return[$key] = mysqli_real_escape_string($this->database, $return[$key]);
  355. # Call plugins
  356. $this->plugins(__METHOD__, 1, func_get_args());
  357. return $return;
  358. }
  359. public function getArchive() {
  360. # Check dependencies
  361. $this->dependencies(isset($this->database, $this->photoIDs));
  362. # Call plugins
  363. $this->plugins(__METHOD__, 0, func_get_args());
  364. # Get photo
  365. $photos = $this->database->query("SELECT title, url FROM lychee_photos WHERE id = '$this->photoIDs' LIMIT 1;");
  366. $photo = $photos->fetch_object();
  367. # Get extension
  368. $extension = $this->getExtension($photo->url);
  369. if ($extension===false) return false;
  370. # Parse title
  371. if ($photo->title=='') $photo->title = 'Untitled';
  372. # Set headers
  373. header("Content-Type: application/octet-stream");
  374. header("Content-Disposition: attachment; filename=\"$photo->title.$extension[0]\"");
  375. header("Content-Length: " . filesize(LYCHEE_UPLOADS_BIG . $photo->url));
  376. # Send file
  377. readfile(LYCHEE_UPLOADS_BIG . $photo->url);
  378. # Call plugins
  379. $this->plugins(__METHOD__, 1, func_get_args());
  380. return true;
  381. }
  382. public function getExtension($filename) {
  383. $extension = strpos($filename, '.') !== false
  384. ? strrchr($filename, '.')
  385. : '';
  386. return $extension;
  387. }
  388. public function setTitle($title) {
  389. # Check dependencies
  390. $this->dependencies(isset($this->database, $this->photoIDs));
  391. # Call plugins
  392. $this->plugins(__METHOD__, 0, func_get_args());
  393. # Parse
  394. if (strlen($title)>50) $title = substr($title, 0, 50);
  395. # Set title
  396. $result = $this->database->query("UPDATE lychee_photos SET title = '$title' WHERE id IN ($this->photoIDs);");
  397. # Call plugins
  398. $this->plugins(__METHOD__, 1, func_get_args());
  399. if (!$result) return false;
  400. return true;
  401. }
  402. public function setDescription($description) {
  403. # Check dependencies
  404. $this->dependencies(isset($this->database, $this->photoIDs));
  405. # Call plugins
  406. $this->plugins(__METHOD__, 0, func_get_args());
  407. # Parse
  408. $description = htmlentities($description);
  409. if (strlen($description)>1000) $description = substr($description, 0, 1000);
  410. # Set description
  411. $result = $this->database->query("UPDATE lychee_photos SET description = '$description' WHERE id IN ('$this->photoIDs');");
  412. # Call plugins
  413. $this->plugins(__METHOD__, 1, func_get_args());
  414. if (!$result) return false;
  415. return true;
  416. }
  417. public function setStar() {
  418. # Check dependencies
  419. $this->dependencies(isset($this->database, $this->photoIDs));
  420. # Call plugins
  421. $this->plugins(__METHOD__, 0, func_get_args());
  422. # Init vars
  423. $error = false;
  424. # Get photos
  425. $photos = $this->database->query("SELECT id, star FROM lychee_photos WHERE id IN ($this->photoIDs);");
  426. # For each photo
  427. while ($photo = $photos->fetch_object()) {
  428. # Invert star
  429. $star = ($photo->star==0 ? 1 : 0);
  430. # Set star
  431. $star = $this->database->query("UPDATE lychee_photos SET star = '$star' WHERE id = '$photo->id';");
  432. if (!$star) $error = true;
  433. }
  434. # Call plugins
  435. $this->plugins(__METHOD__, 1, func_get_args());
  436. if ($error) return false;
  437. return true;
  438. }
  439. public function getPublic($password) {
  440. # Check dependencies
  441. $this->dependencies(isset($this->database, $this->photoIDs));
  442. # Call plugins
  443. $this->plugins(__METHOD__, 0, func_get_args());
  444. # Get photo
  445. $photos = $this->database->query("SELECT public, album FROM lychee_photos WHERE id = '$this->photoIDs' LIMIT 1;");
  446. $photo = $photos->fetch_object();
  447. # Check if public
  448. if ($photo->public==1) return true;
  449. else {
  450. $album = new Album($this->database, null, null, $photo->album);
  451. $acP = $album->checkPassword($password);
  452. $agP = $album->getPublic();
  453. if ($acP===true&&$agP===true) return true;
  454. }
  455. # Call plugins
  456. $this->plugins(__METHOD__, 1, func_get_args());
  457. return false;
  458. }
  459. public function setPublic() {
  460. # Check dependencies
  461. $this->dependencies(isset($this->database, $this->photoIDs));
  462. # Call plugins
  463. $this->plugins(__METHOD__, 0, func_get_args());
  464. # Get public
  465. $photos = $this->database->query("SELECT public FROM lychee_photos WHERE id = '$this->photoIDs' LIMIT 1;");
  466. $photo = $photos->fetch_object();
  467. # Invert public
  468. $public = ($photo->public==0 ? 1 : 0);
  469. # Set public
  470. $result = $this->database->query("UPDATE lychee_photos SET public = '$public' WHERE id = '$this->photoIDs';");
  471. # Call plugins
  472. $this->plugins(__METHOD__, 1, func_get_args());
  473. if (!$result) return false;
  474. return true;
  475. }
  476. function setAlbum($albumID) {
  477. # Check dependencies
  478. $this->dependencies(isset($this->database, $this->photoIDs));
  479. # Call plugins
  480. $this->plugins(__METHOD__, 0, func_get_args());
  481. # Set album
  482. $result = $this->database->query("UPDATE lychee_photos SET album = '$albumID' WHERE id IN ($this->photoIDs);");
  483. # Call plugins
  484. $this->plugins(__METHOD__, 1, func_get_args());
  485. if (!$result) return false;
  486. return true;
  487. }
  488. public function setTags($tags) {
  489. # Check dependencies
  490. $this->dependencies(isset($this->database, $this->photoIDs));
  491. # Call plugins
  492. $this->plugins(__METHOD__, 0, func_get_args());
  493. # Parse tags
  494. $tags = preg_replace('/(\ ,\ )|(\ ,)|(,\ )|(,{1,}\ {0,})|(,$|^,)/', ',', $tags);
  495. $tags = preg_replace('/,$|^,|(\ ){0,}$/', '', $tags);
  496. if (strlen($tags)>1000) return false;
  497. # Set tags
  498. $result = $this->database->query("UPDATE lychee_photos SET tags = '$tags' WHERE id IN ($this->photoIDs);");
  499. # Call plugins
  500. $this->plugins(__METHOD__, 1, func_get_args());
  501. if (!$result) return false;
  502. return true;
  503. }
  504. public function delete() {
  505. # Check dependencies
  506. $this->dependencies(isset($this->database, $this->photoIDs));
  507. # Call plugins
  508. $this->plugins(__METHOD__, 0, func_get_args());
  509. # Get photos
  510. $photos = $this->database->query("SELECT id, url, thumbUrl FROM lychee_photos WHERE id IN ($this->photoIDs);");
  511. # For each photo
  512. while ($photo = $photos->fetch_object()) {
  513. # Get retina thumb url
  514. $thumbUrl2x = explode(".", $photo->thumbUrl);
  515. $thumbUrl2x = $thumbUrl2x[0] . '@2x.' . $thumbUrl2x[1];
  516. # Delete files
  517. if (file_exists(LYCHEE_UPLOADS_BIG . $photo->url)&&!unlink(LYCHEE_UPLOADS_BIG . $photo->url)) return false;
  518. if (file_exists(LYCHEE_UPLOADS_THUMB . $photo->thumbUrl)&&!unlink(LYCHEE_UPLOADS_THUMB . $photo->thumbUrl)) return false;
  519. if (file_exists(LYCHEE_UPLOADS_THUMB . $thumbUrl2x)&&!unlink(LYCHEE_UPLOADS_THUMB . $thumbUrl2x)) return false;
  520. # Delete db entry
  521. $delete = $this->database->query("DELETE FROM lychee_photos WHERE id = '$photo->id';");
  522. if (!$delete) return false;
  523. }
  524. # Call plugins
  525. $this->plugins(__METHOD__, 1, func_get_args());
  526. if (!$photos) return false;
  527. return true;
  528. }
  529. }
  530. ?>