Advertisement
michaelyuen

Untitled

Apr 16th, 2017
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.23 KB | None | 0 0
  1. <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
  2. <script>
  3. $(document).on("click",".file",function(){
  4.   item_url = $(this).data("src");
  5.   var args = top.tinymce.activeEditor.windowManager.getParams();
  6.   win = (args.window);
  7.   input = (args.input);
  8.   win.document.getElementById(input).value = item_url;
  9.   top.tinymce.activeEditor.windowManager.close();
  10. });
  11. </script>
  12. <?php
  13. $path = 'cupload/images/'; // this is the image folder
  14. $files = GLOB($path.'*{.jpg,.png}',GLOB_BRACE);
  15. if (!EMPTY($files)) {
  16.     echo '<ul style="display: inline-block; width: 100%; box-sizing: border-box; list-style: none; padding: 0;">';
  17.     foreach ($files as $file) {
  18.         $file_name = basename($file);
  19.         $file = str_replace(' ', '%20', $file);
  20.         echo "<li class='file' data-src='".$path.$file_name."' style='margin: 10px; width: 100px; display: inline-block; height: 100px; float: left; cursor: pointer;'>
  21.             <div class='file_image' title='".$file_name."' style='display: block; width: 100px; height: 100px; background-image: url(/".$path.'thumb/'.$file_name."); background-position: center center; background-size: cover;'></div></li>";       
  22.     }
  23.     echo '</ul>';  
  24. }
  25. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement