想要在我的laravel项目中使用@section标签显示画布图像

时间:2019-08-30 10:34:52

标签: javascript laravel-5 html5-canvas

我只想在laravel项目中显示画布图像。

我已经在HTML和PHP文件等单独文件中尝试过画布,但画布仍在工作,但是当我试图在laravel项目中显示画布图像时,总图像却无法显示。

    @section('content-wrapper')
<canvas id="canvas" width="484" height="984"></canvas>
@endsection
            @push('scripts')
            <script src="https://www.marvinj.org/releases/marvinj-0.8.js"></script>
        <script>
            var canvas = document.getElementById("canvas");
            image1 = new MarvinImage();
            image1.load("packages/Webkul/Shop/src/Resources/assets/images/Group 1.png", imageLoaded);
            image2 = new MarvinImage();
            image2.load("packages/Webkul/Shop/src/Resources/assets/images/Rectangle 5.png", imageLoaded);
            image3 = new MarvinImage();
            image3.load("packages/Webkul/Shop/src/Resources/assets/images/Motif_2.png", imageLoaded);
            image4 = new MarvinImage();
            image4.load("packages/Webkul/Shop/src/Resources/assets/images/body_design_2.png", imageLoaded);

            var loaded=0;



            function imageLoaded(){
              if(++loaded == 4){
                var image = new MarvinImage(image1.getWidth(), image1.getHeight());
                Marvin.combineByAlpha(image1, image2, image, 43, 0);
                Marvin.combineByAlpha(image, image3, image, 0, 0);
                Marvin.combineByAlpha(image, image4, image, 50, 0);
                image.draw(canvas);
              }
            }

        </script>
        @endpush

只想在我的laravel项目中显示画布。

0 个答案:

没有答案