index.blade.php 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <!-- <link rel = ”stylesheet” href = "{{asset('/pintura/pintura.scss')}}" /> -->
  2. <style>
  3. .my-editor {
  4. height: 600px;
  5. }
  6. </style>
  7. <div class="my-editor"></div>
  8. <script type="module">
  9. import {
  10. // The editor factory method
  11. appendEditor,
  12. // Import the default image reader and writer
  13. createDefaultImageReader,
  14. createDefaultImageWriter,
  15. // The method used to register the plugins
  16. setPlugins,
  17. // The plugins we want to use
  18. plugin_crop,
  19. plugin_finetune,
  20. plugin_filter,
  21. plugin_annotate,
  22. // The user interface and plugin locale objects
  23. locale_en_gb,
  24. plugin_crop_locale_en_gb,
  25. plugin_finetune_locale_en_gb,
  26. plugin_filter_locale_en_gb,
  27. plugin_annotate_locale_en_gb,
  28. // Because we use the annotate plugin we also need
  29. // to import the markup editor locale and the shape preprocessor
  30. markup_editor_locale_en_gb,
  31. createDefaultShapePreprocessor,
  32. // Import the default configuration for the markup editor and finetune plugins
  33. markup_editor_defaults,
  34. plugin_finetune_defaults,
  35. plugin_filter_defaults,
  36. } from "../pintura/pintura.js";
  37. // This registers the plugins with Pintura Image Editor
  38. setPlugins(plugin_crop, plugin_finetune, plugin_filter);
  39. // Append the editor
  40. appendEditor(".my-editor", {
  41. // The source image to load
  42. src: "./my-image.jpeg",
  43. // This will read the image data (required)
  44. imageReader: createDefaultImageReader(),
  45. // This will write the output image
  46. imageWriter: createDefaultImageWriter(),
  47. // The markup editor default options, tools, shape style controls
  48. ...markup_editor_defaults,
  49. // The finetune util controls
  50. ...plugin_finetune_defaults,
  51. // The filter util controls
  52. ...plugin_filter_defaults,
  53. // This handles complex shapes like arrows / frames
  54. shapePreprocessor: createDefaultShapePreprocessor(),
  55. // This will set a square crop aspect ratio
  56. imageCropAspectRatio: 1,
  57. // The icons and labels to use in the user interface (required)
  58. locale: {
  59. ...locale_en_gb,
  60. ...plugin_crop_locale_en_gb,
  61. ...plugin_finetune_locale_en_gb,
  62. ...plugin_filter_locale_en_gb,
  63. ...plugin_annotate_locale_en_gb,
  64. ...markup_editor_locale_en_gb,
  65. },
  66. });
  67. </script>