SproutCMS

This is the code documentation for the SproutCMS project

source of /sprout/views/tinymce4/image_size.php

  1. <?php
  2. /*
  3.  * kate: tab-width 4; indent-width 4; space-indent on; word-wrap off; word-wrap-column 120;
  4.  * :tabSize=4:indentSize=4:noTabs=true:wrap=false:maxLineLen=120:mode=php:
  5.  *
  6.  * Copyright (C) 2015 Karmabunny Pty Ltd.
  7.  *
  8.  * This file is a part of SproutCMS.
  9.  *
  10.  * SproutCMS is free software: you can redistribute it and/or modify it under the terms
  11.  * of the GNU General Public License as published by the Free Software Foundation, either
  12.  * version 3 of the License, or (at your option) any later version.
  13.  *
  14.  * For more information, visit <http://getsproutcms.com>.
  15.  */
  16.  
  17. use Sprout\Helpers\Enc;
  18. use Sprout\Helpers\File;
  19.  
  20.  
  21. echo $toolbar;
  22. ?>
  23.  
  24. <div class="info">
  25. Choose the size you would like to insert the image <b><?php echo Enc::html($image['name']); ?></b>.
  26. </div>
  27.  
  28. <?php
  29. echo '<ul class="link-list">';
  30.  
  31. if ($up_url) {
  32. echo '<li class="up"><a href="', Enc::html($up_url), '">Up one level</a></li>';
  33. }
  34.  
  35. foreach ($sizes as $size) {
  36. echo '<li class="size">';
  37. echo '<a href="javascript:;" data-src="', Enc::html(File::sizeUrl($image['id'], $size)), '" data-alt="', Enc::html($image['name']), '">', ucwords(str_replace('_', ' ', $size)), '</a>';
  38. echo '</li>';
  39. }
  40. echo '<li class="size">';
  41. echo '<a href="javascript:;" data-src="', Enc::html(File::relUrl($image['id'])), '" data-alt="', Enc::html($image['name']), '">Original</a>';
  42. echo '</li>';
  43.  
  44. echo '</ul>';
  45. ?>
  46.  
  47. <script>
  48. $(document).ready(function(){
  49. $("a[data-src]").click(function(){
  50. TinyMCE4.setUrl($(this).attr("data-src"));
  51. TinyMCE4.setField("Image description", $(this).attr("data-alt"));
  52. TinyMCE4.setField("Dimensions", "");
  53. TinyMCE4.closePopup();
  54. });
  55. })
  56. </script>
  57.