Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script src="https://code.jquery.com/jquery-2.2.4.min.js" integrity="sha256-BbhdlvQf/xTY9gja0Dq3HiwQF8LaCRTXxZKRutelT44=" crossorigin="anonymous"></script>
- <script>
- $(document).on("click",".file",function(){
- item_url = $(this).data("src");
- var args = top.tinymce.activeEditor.windowManager.getParams();
- win = (args.window);
- input = (args.input);
- win.document.getElementById(input).value = item_url;
- top.tinymce.activeEditor.windowManager.close();
- });
- </script>
- <?php
- $path = 'cupload/images/'; // this is the image folder
- $files = GLOB($path.'*{.jpg,.png}',GLOB_BRACE);
- if (!EMPTY($files)) {
- echo '<ul style="display: inline-block; width: 100%; box-sizing: border-box; list-style: none; padding: 0;">';
- foreach ($files as $file) {
- $file_name = basename($file);
- $file = str_replace(' ', '%20', $file);
- echo "<li class='file' data-src='".$path.$file_name."' style='margin: 10px; width: 100px; display: inline-block; height: 100px; float: left; cursor: pointer;'>
- <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>";
- }
- echo '</ul>';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement