问题标签 [liipimaginebundle]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
2 回答
914 浏览

symfony - Avalanche Imagine Bundle 如何在生产环境中工作?

我尝试使用AvalancheImagineBundle,但我不明白它如何在生产环境中工作。

默认的 cache_prefix 是 media/cache。所有缓存的图像都将在 myProject/web/media/cache 目录中,它也是一个 Symfony2 路由:

如果我对此网址“ http://my-project.fr/app.php/ ”进行测试,则捆绑包可以正常工作:

  1. 第一次,我尝试显示 /app.php/media/cache/thumbnail/profile.jpg 图片。Symfony2 路由被捕获。捆绑包返回裁剪的图片并将其缓存。
  2. 第二次,路由又被抓到了,bundle把我重定向到缓存的图片/media/cache/

简而言之,第一次 /app.php/media/cache -> bundle,第二次 /media/cache -> assets

但是在生产环境中,app.php 丢失了,那么捆绑包怎么能做到这一点呢?

0 投票
1 回答
6387 浏览

image - 使用 liipImagineBundle 的动态过滤器

我正在使用 liipImagineBundle 并尝试将过滤器直接应用到控制器中。

在文档中,我找到了两个部分,其中解释了如何从控制器中使用 liipImagineBundle。这个https://github.com/liip/LiipImagineBundle#using-the-controller-as-a-service

https://github.com/liip/LiipImagineBundle/blob/master/Resources/doc/filters.md#dynamic-filters

我按照“将控制器用作服务”中的说明进行了测试,它可以工作,我遇到的问题是我不知道如何访问过滤器设置来修改它。

第二个,真的,当他说“使用自定义数据加载器......”时,我不明白。

在示例中,他仅修改了 ImagineController 类 (Liip\ImagineBundle\Controller) 中的方法 filteraction()。我想知道如何动态修改该方法?例如来自我的控制器 indexAction()。

我也读过这篇文章https://stackoverflow.com/questions/16166719/loading-your-custom-filters-with-liipimaginebundle其中@NSCoder 说“您可以使用内置过滤器并修改它们的配置。” 但我不明白。

我一直在寻找几天,但我还没有找到一个可以开始的例子。

0 投票
1 回答
1334 浏览

symfony - Nginx accesslog for LiipImagineBundle images

I have the LiipImagineBundle installed in my Symfony2 2.1.10 installation and I experience a little configuration problem with my nginx server. On the net I discovered this nice snippet as a great and simple nginx configuration for Symfony2 apps. I added some lines of code. Most importantly I want to be able to disable the access.log for static files like images. The following ruleset was working flawlessly:

But today I discovered that images generated by the LiipImagineBundle need to be accessed via the app.php or the app_dev.php. Otherwise they don't get generated and nginx logs the following error message:

Which is basically a 404. The file doesn't get generated because it is not accessed via the Symfony2 application but directly.

I need a configuration that allows me to disable the access-logging and adding some caching headers to static files, but still serve them through the same route as before.

Is there a possible solution for that?

0 投票
1 回答
3657 浏览

php - Symfony2 与 KnpGaufrette 与 S3 与 LiipImagine

我试图让 LiipImagine 在我的 Symfony2 项目中运行,使用 KnpGraufette Bundle 来访问我的 Amazon AWS S3 帐户。

现在我已经可以访问 S3、存储和加载数据以及所有内容了。我可以使用 LiipImagine 过滤本地图像。到目前为止,一切都很好。

现在我使用以下配置将我的 gaufrette/s3 服务和 LiipImagine 粘合在一起,如本教程中所示。

使用 LiipImagine 过滤 S3 资源时,出现以下错误:

测试我的过滤的代码是这样的:

另外:版主可以添加Tag Gaufrette、KnpGaufrette 或KnpGaufretteBundle 吗?

0 投票
1 回答
1651 浏览

php - symfony2 中的 Avalanche-imagine 问题

我正在尝试使用 Avalanche-imagine 包创建缩略图。我使用 OS X 10.7 Lion 和 MAMP PRO 作为 Apache 服务器。

当我在树枝文件中调用过滤器时,出现 500 错误。

在这里我手动放置路径来检查它:

我收到这条消息:GET

(内部服务器错误)

第 35 行,这很奇怪,因为我的缩略图被远远放在后面

我按照以下说明安装了捆绑包:https ://github.com/avalanche123/AvalancheImagineBundle

我不得不说我在安装它时遇到了几个问题,因为 composer.phar 给了我一条错误消息:

“问题 1 - symfony/icu v1.2.0 需要 lib-icu >=4.4 -> 请求的链接库 icu 安装了错误的版本或从您的系统中丢失,请确保有提供它的扩展。- symfony/icu v1 .2.0 需要 lib-icu >=4.4 -> 请求的链接库 icu 安装了错误的版本或从您的系统中丢失,请确保有提供它的扩展。 - symfony/icu 1.2.* 的安装请求 -> 可满足通过 symfony/icu[v1.2.0]。”

我在 composer.json 要求中添加了这一行来解决它:

安装后,我可以使用作曲家安装 AvalancheImageBundle。

然后我改变了 AppKernel,正如他们在指令中所说的那样:

但我没有像安装 FOSUserBundle 时那样更改自动加载文件。我必须在那里添加任何东西吗?

我试过这个,但它没有解决我的问题:

附加信息:

我的项目位于: Symfony2/proyecto/taller/here_are_web_app_vendor_and_src 我的 apache 服务器的目标是: Symfony2/proyecto/taller 使用 sortcut taller 而不是 localhost 我的 url 是这样的:

我的图片在 url 中: Symfony2/proyecto/taller/web/store/images/Pictures/test.jpg 巫婆 url 我应该给过滤器吗?我认为是 store/images/Pictures/test.jpg

问题可能出在包的依赖项上,因为我把那行放在 composer.json?

也许我应该在自动加载文件中写一些东西?有没有提到供应商/想象错过?

我也尝试安装 liipImagine 包,但我不能,因为它说我已经安装了想象 0.3.0,我需要想象 0.4.0。如何卸载imagine并安装新版本来运行liipimaginebudle?

应用内核:

如您所见,没有参考想象(我猜它在 Avalanchebundle 中的整数)

自动加载:( 没有提到雪崩?)

这是我的图片所在的位置,您可以看到 Avalanche 如何创建媒体文件夹:

这是我的供应商文件:

我不知道问题出在哪里,这就是为什么我放了这么多信息。

0 投票
1 回答
569 浏览

liipimaginebundle - 如何在树枝中使用 liipimaginebundle 过滤器集

我的配置文件中有以下过滤器集,我的问题是在树枝中使用不同的过滤器

如果有一个过滤器,它会是这样的,

但现在我不知道如何使用它。

0 投票
2 回答
880 浏览

php - 使用 Imagine bundle 调整图像大小模糊图像

我有以下代码:

由于某种原因,调整大小的图像总是有点模糊,您可以在这里看到调整大小的图像和原始图像,这里调整大小的图像。我已经没有想法为什么会这样了。知道为什么吗?

0 投票
4 回答
6948 浏览

php - 使用 liipImagineBundle 更新/删除记录时删除/更新缓存图像

我是 symfony2 的新手。我正在使用 liipImagineBundle 来管理图像缩略图。我有一个产品实体类,它使用生命周期回调来管理产品图像。

产品.php

配置.yml

缩略图生成代码

缩略图生成正确。

但是我无法找到在原始图像更改或使用表单删除时更新/删除缓存图像的方法。

0 投票
2 回答
221 浏览

php - 在某些 url 上使用 prod 环境,而在 dev env 中

我正在使用优秀的 ht​​tps ://github.com/liip/LiipImagineBundle包来显示图像。但是在开发环境中工作时,生成的 url 会变成这样:

当有 20-30 张图片时,我的程序会爬行。我也得到很多连接超时,因为 app_dev.php 贯穿整个固件。

问题:我能否以某种方式设置 Symfony 为某些部分生成生产 URL,同时仍在开发中?IE。无论环境如何,LiipImagineBundle 总是生成生产 URL?

或者我该如何更改 .htaccess 以使用

每当有

成立

0 投票
3 回答
1535 浏览

image - Symfony2 LiipImagineBundle 默认图像

我正在将 LiipImagineBundle 用于使用 symfony2 构建的应用程序,并且我想在图像不存在时显示默认图像。假设我有

当 '/profiles/foo.JPG' 不存在时,如何显示 default.jpg?

谢谢,