thumbnail.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. /**
  3. * Tidypics thumbnail creation tool
  4. */
  5. $title = elgg_echo('tidypics:settings:thumbnail');
  6. $body = '<p>' . elgg_echo('tidypics:thumbnail_tool_blurb') . '</p>';
  7. $im_id = elgg_echo('tidypics:settings:im_id');
  8. $input = elgg_view('input/text', array(
  9. 'name' => 'image_id'
  10. ));
  11. $submit = elgg_view('input/submit', array(
  12. 'value' => elgg_echo('submit'),
  13. 'id' => 'elgg-tidypics-im-test'
  14. ));
  15. $body .=<<<HTML
  16. <p>
  17. <label>$im_id $input</label>
  18. </p>
  19. <p>
  20. $submit
  21. <div id="elgg-tidypics-im-results"></div>
  22. </p>
  23. HTML;
  24. echo elgg_view_module('inline', $title, $body);
  25. ?>
  26. <script type="text/javascript">
  27. $(function() {
  28. $('#elgg-tidypics-im-test').click(function() {
  29. var image_id = $('input[name=image_id]').val();
  30. $("#elgg-tidypics-im-results").html('<div class="elgg-ajax-loader"></div>');
  31. elgg.action('photos/admin/create_thumbnails', {
  32. format: 'JSON',
  33. data: {guid: image_id},
  34. cache: false,
  35. success: function(result) {
  36. // error
  37. if (result.status < 0) {
  38. var html = '';
  39. } else {
  40. var html = '<img class="elgg-photo tidypics-photo" src="'
  41. + result.output.thumbnail_src + '" alt="' + result.output.title
  42. + '" />';
  43. }
  44. $("#elgg-tidypics-im-results").html(html);
  45. }
  46. });
  47. });
  48. });
  49. </script>