Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong mimetypes for phpcr images #167

Closed
levuro opened this issue Apr 2, 2013 · 7 comments · Fixed by #169
Closed

wrong mimetypes for phpcr images #167

levuro opened this issue Apr 2, 2013 · 7 comments · Fixed by #169

Comments

@levuro
Copy link

levuro commented Apr 2, 2013

using the data_loader: phpcr works fine but all images dont have an extension -
a extension is needed for apache to send the correct mime type.

since there is already talk about using something other than the name of the content document image field - (cache busting ) it would be great to add the correct extension based on the content of the (binary) image

so
http://joiz.lo/media/cache/cmf_169_70/cms/content/show/Darlingz/iconImage
would become
http://joiz.lo/media/cache/cmf_169_70/cms/content/show/Darlingz/iconImage_cashbustingidentifier.gif

@lsmith77 lsmith77 mentioned this issue Apr 2, 2013
@lsmith77
Copy link
Contributor

lsmith77 commented Apr 2, 2013

in the file system loader we go through several steps to try and find the on disc file based on the provided path. we should add similar logic to the phpcr loader:
https://github.com/liip/LiipImagineBundle/blob/master/Imagine/Data/Loader/FileSystemLoader.php

ie. we should do a findMany() call where we first check for the exact match but additionally if an extension is provided in the file name also include the path without any extension as well as the configured list of supported extensions.

@lsmith77
Copy link
Contributor

lsmith77 commented Apr 4, 2013

can you try #169 ?

note the service definition changed

@levuro
Copy link
Author

levuro commented Apr 4, 2013

hi lukas,

i tried it but i dont see any changes ....i changed the data loaders in config and joiz.imagine.data_loader.phpcr signature.
did i miss something?

thanks
eric

my diff

diff --git a/app/main/config/config.yml b/app/main/config/config.yml
index 3aee2bf..b760e6e 100644
--- a/app/main/config/config.yml
+++ b/app/main/config/config.yml
@@ -307,55 +307,56 @@
data_root: %dynamic.assets_base_path%
web_root: %kernel.root_dir%/../../web
cache_prefix: /media/cache

  • formats: [gif,jpg,png]
    filter_sets:
    #bottom teaser
    cmf_140_180:
  •        data_loader: phpcr
    
  •        data_loader: doctrine_phpcr
         filters:
             thumbnail: { size: [140, 180], mode: outbound }
    

diff --git a/composer.lock b/composer.lock
index 45ca178..9d51e03 100644
--- a/composer.lock
+++ b/composer.lock
@@ -1820,12 +1820,12 @@
"source": {
"type": "git",
"url": "https://github.com/liip/LiipImagineBundle.git",

  •            "reference": "9041ed99f59b3b1cdac084112ada19a799ea0127"
    
  •            "reference": "869a33cc1156c1c6080c932a12802eba1d20a393"
         },
         "dist": {
             "type": "zip",
             "url": "https://api.github.com/repos/liip/LiipImagineBundle/zipball/9041ed99f59b3b1cdac084112ada19a799ea0127",
    
  •            "reference": "9041ed99f59b3b1cdac084112ada19a799ea0127",
    
  •            "reference": "869a33cc1156c1c6080c932a12802eba1d20a393",
             "shasum": ""
         },
         "require": {
    

diff --git a/src/Joiz/CmsBundle/Resources/config/services.yml b/src/Joiz/CmsBundle/Resources/config/services.yml
index 2188cd0..bc25699 100644
--- a/src/Joiz/CmsBundle/Resources/config/services.yml
+++ b/src/Joiz/CmsBundle/Resources/config/services.yml
@@ -67,9 +67,10 @@
joiz.imagine.data_loader.phpcr:
class: Liip\ImagineBundle\Imagine\Data\Loader\DoctrinePHPCRLoader
tags:

  •        - { name: liip_imagine.data.loader, loader: phpcr }
    
  •        - { name: liip_imagine.data.loader, loader: doctrine_phpcr }
     arguments:
         - @liip_imagine
    
  •        - %liip_imagine.formats%
    
  •        - %liip_imagine.web_root%
         - @doctrine_phpcr.odm.document_manager
    
  •        - Doctrine\ODM\PHPCR\Document\Image
    
  •        - ~
    
    \ No newline at end of file
  •        - Doctrine\ODM\PHPCR\Document\Image
    
    \ No newline at end of file

On 04.04.2013, at 10:59, Lukas Kahwe Smith notifications@github.com wrote:

can you try #169 ?

note the service definition changed


Reply to this email directly or view it on GitHub.

@lsmith77
Copy link
Contributor

lsmith77 commented Apr 4, 2013

you need to adjust the template to include the extension you want in the file name:

{{ '/foo/image_test.png' | imagine_filter('my_thumb') }}

this will now work even if there is only a node /foo/image_test

@levuro
Copy link
Author

levuro commented Apr 4, 2013

its prob just me beeing stupid - but this doesnt work !

{{ content.teaserImage~'.jpg'| imagine_filter('cmf_319_179') }}

On 04.04.2013, at 12:04, Lukas Kahwe Smith notifications@github.com wrote:

you need to adjust the template to include the extension you want in the file name:

{{ '/foo/image_test.png' | imagine_filter('my_thumb') }}

this will now work even if there is only a node /foo/image_test


Reply to this email directly or view it on GitHub.

@havvg
Copy link
Contributor

havvg commented Apr 4, 2013

@JOiz Your code is wrong.

{{ content.teaserImage~'.jpg'| imagine_filter('cmf_319_179') }}

What you actually want:

{{ (content.teaserImage~'.jpg')|imagine_filter('cmf_319_179') }}

@lsmith77
Copy link
Contributor

lsmith77 commented Apr 4, 2013

yeah .. figure it out .. there were some other issues. all fixed now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants