如何将图片拷贝到网页文件夹中

时间:2022-03-14 00:29:31

I can't believe that I'm not able to google this...

我真不敢相信我竟然不能把这个……

So, I have a symfony2 application, and I installed jQuery UI with Composer. That means i have project structure like this:

因此,我有一个symfony2应用程序,我用Composer安装了jQuery UI。这意味着我有这样的项目结构:

/app/
/src/
/vendor/components/jqueryui/
/web/

I have assetic set up to copy js/css files from the vendor folder to web. That works fine. Config:

我已经设置好将js/css文件从供应商文件夹复制到web。工作的很好。配置:

assetic:
    assets:
        javascripts:
            inputs:
                - %kernel.root_dir%/../vendor/components/jquery/jquery.js
                - %kernel.root_dir%/../vendor/components/jqueryui/ui/jquery-ui.js
                - %kernel.root_dir%/../vendor/components/jqueryui/ui/i18n/jquery.ui.datepicker-cs.js
        stylesheets:
            inputs:
                - %kernel.root_dir%/../vendor/components/jqueryui/themes/redmond/jquery-ui.css
            filters: cssrewrite

After assetic:dump i have

后assetic:转储

/web/js
/web/css

cssrewrite rewrites images/image.png to ../images/image.png. I guess that's ok, assumes a /web/images directory with said images.

cssrewrite重写图像/形象。png图像. . / / image.png。我想这是可以的,假设a /web/images目录中有这样的图片。

Now the question is: How do I copy the images from /vendor/components/jqueryui/themes/redmond/images to /web/images?

现在的问题是:如何从/供应商/组件/jqueryui/主题/redmond/图像复制到/web/图像?

Or is there another best practice to do that? Excuse me if it's and obvious thing, I'm a .NET guy, just trying out PHP.

或者还有其他的最佳实践吗?不好意思,很明显,我是。net的人,只是在尝试PHP。

1 个解决方案

#1


1  

My answer probably isn't spot-on because I haven't tried this with vendor files but this is what worked for me:

我的回答可能并不准确,因为我还没有尝试过供应商文件,但这正是我所需要的:

app/console assets:install

It copies all of your public resources to your web directory.

它将所有公共资源复制到您的web目录。

This answer by user1814739 helped me understand this and may provide additional information for you.

user1814739的答案帮助我理解了这一点,并可能为您提供更多的信息。

Also consider this advice from the Symfony Blog:

还可以参考一下Symfony博客的建议:

Although developers usually execute the command without any option, most of the time it's better to execute it with the --symlink option. This makes a symbolic link of your assets instead of actually copying their files. This means that any change in the content of the web assets will have immediate effect in the application.

虽然开发人员通常执行命令时没有任何选项,但是大多数时候最好使用-symlink选项执行。这将使您的资产成为一个符号链接,而不是实际复制它们的文件。这意味着web资产内容的任何更改都将在应用程序中立即生效。

#1


1  

My answer probably isn't spot-on because I haven't tried this with vendor files but this is what worked for me:

我的回答可能并不准确,因为我还没有尝试过供应商文件,但这正是我所需要的:

app/console assets:install

It copies all of your public resources to your web directory.

它将所有公共资源复制到您的web目录。

This answer by user1814739 helped me understand this and may provide additional information for you.

user1814739的答案帮助我理解了这一点,并可能为您提供更多的信息。

Also consider this advice from the Symfony Blog:

还可以参考一下Symfony博客的建议:

Although developers usually execute the command without any option, most of the time it's better to execute it with the --symlink option. This makes a symbolic link of your assets instead of actually copying their files. This means that any change in the content of the web assets will have immediate effect in the application.

虽然开发人员通常执行命令时没有任何选项,但是大多数时候最好使用-symlink选项执行。这将使您的资产成为一个符号链接,而不是实际复制它们的文件。这意味着web资产内容的任何更改都将在应用程序中立即生效。