index_old.php 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. if (!empty($_REQUEST['path'])) {
  3. $path = $_REQUEST['path'];
  4. if (is_readable($path) && !empty($_REQUEST['raw'])) {
  5. header('content-type: image/jpeg');
  6. print file_get_contents($path);
  7. exit;
  8. }
  9. }
  10. else {
  11. die('File not found');
  12. }
  13. ?>
  14. <!DOCTYPE html>
  15. <html>
  16. <head>
  17. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  18. <title>iviewer</title>
  19. <script type="text/javascript" src="/js/jquery-1.7.2.min.js" ></script>
  20. <script type="text/javascript" src="/js/jquery-ui-1.8.20.custom.min.js" ></script>
  21. <script type="text/javascript" src="/js/jquery.mousewheel.min.js" ></script>
  22. <script type="text/javascript" src="/js/iviewer/jquery.iviewer.js" ></script>
  23. <script type="text/javascript">
  24. var $ = jQuery;
  25. $(document).ready(function(){
  26. var iv1 = $("#viewer").iviewer({
  27. src: "/view/file/?path=<?php echo $path ?>&raw=true",
  28. update_on_resize: false,
  29. zoom_animation: true,
  30. mousewheel: true,
  31. onMouseMove: function(ev, coords) { },
  32. onStartDrag: function(ev, coords) { return false; }, //this image will not be dragged
  33. onDrag: function(ev, coords) { }
  34. });
  35. $("#in").click(function(){ iv1.iviewer('zoom_by', 1); });
  36. $("#out").click(function(){ iv1.iviewer('zoom_by', -1); });
  37. $("#fit").click(function(){ iv1.iviewer('fit'); });
  38. $("#orig").click(function(){ iv1.iviewer('set_zoom', 100); });
  39. $("#update").click(function(){ iv1.iviewer('update_container_info'); });
  40. /*
  41. var iv2 = $("#viewer2").iviewer(
  42. {
  43. src: "test_image2.jpg"
  44. });
  45. $("#chimg").click(function()
  46. {
  47. iv2.iviewer('loadImage', "test_image.jpg");
  48. return false;
  49. });*/
  50. });
  51. </script>
  52. <link rel="stylesheet" href="/js/iviewer/jquery.iviewer.css" />
  53. <style>
  54. .viewer
  55. {
  56. width: 50%;
  57. height: 500px;
  58. border: 1px solid black;
  59. position: relative;
  60. }
  61. .wrapper
  62. {
  63. overflow: hidden;
  64. }
  65. </style>
  66. </head>
  67. <body>
  68. <h1>iviewer</h1>
  69. <!-- wrapper div is needed for opera because it shows scroll bars for reason -->
  70. <div class="wrapper">
  71. <span>
  72. <a id="in" href="#">+</a>
  73. <a id="out" href="#">-</a>
  74. <a id="fit" href="#">fit</a>
  75. <a id="orig" href="#">orig</a>
  76. <a id="update" href="#">update</a>
  77. </span>
  78. <div id="viewer" class="viewer"></div>
  79. </div>
  80. </body>
  81. </html>