97.cache.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php return '/**
  2. * pThumb
  3. * Copyright 2013-2014 Jason Grant
  4. *
  5. * Please see the GitHub page for documentation or to report bugs:
  6. * https://github.com/oo12/phpThumbOf
  7. *
  8. * Forked from phpThumbOf 1.4.0
  9. * Copyright 2009-2012 by Shaun McCormick <shaun@modx.com>
  10. *
  11. * pThumb is free software; you can redistribute it and/or modify it
  12. * under the terms of the GNU General Public License as published by the Free
  13. * Software Foundation; either version 2 of the License, or (at your option) any
  14. * later version.
  15. *
  16. * pThumb is distributed in the hope that it will be useful, but WITHOUT ANY
  17. * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
  18. * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License along with
  21. * phpThumbOf; if not, write to the Free Software Foundation, Inc., 59 Temple
  22. * Place, Suite 330, Boston, MA 02111-1307 USA
  23. *
  24. */
  25. /**
  26. *
  27. * @var modX $modx
  28. * @var array $scriptProperties
  29. * @var string $input
  30. * @var string|array $options
  31. *
  32. */
  33. if (empty($input)) { // Exit quietly if no file name given
  34. return;
  35. }
  36. $scriptProperties[\'debug\'] = isset($debug) ? $debug : false;
  37. static $pt_settings = array();
  38. if (empty($pt_settings)) {
  39. if (!$modx->loadClass(\'phpThumbOf\', MODX_CORE_PATH . \'components/phpthumbof/model/\', true, true)) {
  40. $modx->log(modX::LOG_LEVEL_ERROR, \'[pThumb] Could not load phpThumbOf class.\');
  41. return $input;
  42. }
  43. }
  44. $pThumb = new phpThumbOf($modx, $pt_settings, $scriptProperties);
  45. $result = $pThumb->createThumbnail($input, $options);
  46. if (!empty($toPlaceholder) || $result[\'outputDims\']) {
  47. if ($result[\'width\'] === \'\' && $result[\'file\'] && $dims = getimagesize($result[\'file\']) ) {
  48. $result[\'width\'] = $dims[0];
  49. $result[\'height\'] = $dims[1];
  50. }
  51. if (!empty($toPlaceholder)) {
  52. $modx->setPlaceholders(array(
  53. $toPlaceholder => $result[\'src\'],
  54. "$toPlaceholder.width" => $result[\'width\'],
  55. "$toPlaceholder.height" => $result[\'height\']
  56. ));
  57. $output = \'\';
  58. }
  59. if ($result[\'outputDims\']) {
  60. $output = "src=\\"{$result[\'src\']}\\"" . ($result[\'width\'] ? " width=\\"{$result[\'width\']}\\" height=\\"{$result[\'height\']}\\"" : \'\');
  61. }
  62. }
  63. else {
  64. $output = $result[\'src\'];
  65. }
  66. if ($debug && $result[\'success\']) { // if debugging is on and createThumbnail was successful, log the debug info
  67. $pThumb->debugmsg(isset($pThumb->phpThumb->debugmessages) ? \':: Processed ::\' : ":: Loaded from cache: {$result[\'src\']}", true);
  68. }
  69. return $output;
  70. return;
  71. ';