亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Symfony / liip_imagine : 圖像路徑解析結果為 404

Symfony / liip_imagine : 圖像路徑解析結果為 404

PHP
桃花長相依 2022-10-28 09:51:35
服務器配置Symfony 4.4.2Apache 2.4.29PHP: 7.3Hosting: AWS LightSail我使用 liip_imagine 包來處理上傳的圖像并使用 asset(). 不幸的是,圖像 URL 解析為 404,我不知道為什么。這是相關的樹枝模板:<div class="col">  <p>{{ 'Current image' | trans }}</p>      {% if module.image != '' %}           <img style="width: 180px;" src="{{ asset(module.image | imagine_filter('learningModuleImage')) }}" alt="">       {% endif %}</div>我檢查了這個:文件已正確上傳到 /public/upload 文件夾中。module.image 確實包含圖像哈希名稱和擴展名:da305b9a0fee3eb7bdc5bfc9b64e88ff.jpeg真實網址: /public/upload/da305b9a0fee3eb7bdc5bfc9b64e88ff.jpeg生成的網址:https://domain.tld/media/cache/learningModuleImage/da305b9a0fee3eb7bdc5bfc9b64e88ff.jpeg配置:liip_imagine:    loaders:        default:            filesystem:                data_root:                    - "%kernel.project_dir%/public/upload"                    - "%kernel.project_dir%/public/assets/img"    resolvers:        default:            web_path:                web_root: "%kernel.project_dir%/public/upload"                cache_prefix: media/cache    filter_sets:        cache: ~        learningModuleImage:            filters:                downscale:                    max: [512, 512]        profile:            filters:                downscale:                    max: [512, 512]        # the name of the "filter set"        thumb:            # adjust the image quality to 75%            # quality: 75            # list of transformations to apply (the "filters")            filters:                # create a thumbnail: set size to 120x90 and use the "outbound" mode                # to crop the image when the size ratio of the input differs                thumbnail: { size: [128, 128], mode: outbound }                # create a 2px black border: center the thumbnail on a black background                # 4px larger to create a 2px border around the final image                # background: { size: [124, 94], position: center, color: '#000000' }
查看完整描述

1 回答

?
有只小跳蛙

TA貢獻1824條經驗 獲得超8個贊

我解決了!


這是工作配置。謝謝@MaulikParmar 的提示!



liip_imagine:

    loaders:

        default:

            filesystem:

                data_root:

                    - "%kernel.project_dir%/public/upload"

                    - "%kernel.project_dir%/public/assets/img"


    resolvers:

        default:

            web_path:

                web_root: "%kernel.project_dir%/public"

                cache_prefix: media/cache


    filter_sets:

        cache: ~

        learningModuleImage:

            cache: default

            filters:

                downscale:

                    max: [512, 512]

        profile:

            filters:

                downscale:

                    max: [512, 512]


        # the name of the "filter set"

        thumb:

            # adjust the image quality to 75%

            # quality: 75

            cache: default

            # list of transformations to apply (the "filters")

            filters:

                # create a thumbnail: set size to 120x90 and use the "outbound" mode

                # to crop the image when the size ratio of the input differs

                thumbnail: { size: [128, 128], mode: outbound }

                # create a 2px black border: center the thumbnail on a black background

                # 4px larger to create a 2px border around the final image

                # background: { size: [124, 94], position: center, color: '#000000' }



查看完整回答
反對 回復 2022-10-28
  • 1 回答
  • 0 關注
  • 118 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號