Bug #82057

file:current:crop does not work anymore for page media resources

Added by Markus Timtner 12 months ago. Updated 7 months ago.

Status:
Resolved
Priority:
Must have
Category:
Image Cropping
Target version:
Start date:
2017-08-08
Due date:
% Done:

100%

TYPO3 Version:
8
PHP Version:
7.0
Tags:
fluid_styled_content, menu, typoscript, file:current:crop
Complexity:
medium
Is Regression:
Yes
Sprint Focus:
On Location Sprint

Description

If one adds an image in page media resources and decides to crop it,
the cropping data isn't passed through "data" anymore.

This used to work in v7!

References:
http://www.typo3-probleme.de/2017/02/01/typo3-7-6-seiteneigenschaften-bild-ressourcen-via-fluid-auslesen-1897/
http://www.typo3forum.net/discussion/78240/menue-der-unterseiten-mit-bild-jetzt-fuer-fluid-styled-content-und-richtigem-ausschnitt-crop

For Testing, I have this fsc Tempate for MenuAbstract:

<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers" data-namespace-typo3-fluid="true">
<f:layout name="Default" />
<f:section name="Main">

    <f:if condition="{menu}">
        <ul>
            <f:for each="{menu}" as="page">
                <li>
                    <a href="{page.link}" target="{page.target}" title="{page.title}">
                        <span>{page.title}</span>
                    </a>
                    <f:if condition="{page.data.abstract}">
                        <f:format.html>{page.data.abstract}</f:format.html>
                    </f:if>
                    <f:if condition="{page.data.media}">
                        <f:debug title="My Debug Statement" inline="1">{page}</f:debug>
                        <f:cObject typoscriptObjectPath="lib.pageimage" data="{page.data}"  />
                    </f:if>

                </li>
            </f:for>
        </ul>
    </f:if>

</f:section>
</html>

And this typoscript here:

lib.pageimage = FILES
lib.pageimage {
        references {
            table = pages
            #Seiten-ID ubergabe
            uid.dataWrap= {field:uid}
            fieldName = media
        }
        renderObj = IMAGE
        renderObj {
            file {
                treatIdAsReference = 1
                width       = 780c
                #height      = 380c
                import.data = file:current:uid
                crop.data   = file:current:crop
            }
            #altText.data = file:current:alternative
            altText.data = file:current:crop
            params = class="img-responsive" 
            wrap = |
        }
    }
}

For testing, I have the contents of "file:current:crop" in altText.data, which yields:

alt=',"selectedRatio":"NaN","focusArea":null}}'

The same typoscript works in v7 as expected, altText.data shows this result:

alt="{&quot;x&quot;:207.1372549019608,&quot;y&quot;:105.4656862745098,&quot;width&quot;:265,&quot;height&quot;:165.5,&quot;rotate&quot;:0}" 

Anybody any ideas?
If someone can point me in the right direction I will have a look.


Related issues

Related to TYPO3 Core - Bug #71164: ImageManipulation Using in Page Resources Media Relation New 2015-10-30
Related to TYPO3 Core - Story #75880: Add art direction capabilities to BE Resolved 2017-02-23

Associated revisions

Revision 4fab2d67 (diff)
Added by Wolfgang Klinger 7 months ago

[BUGFIX] Get the correct crop configuration for imgResource

This fix returns the right ImageManipulation\Area object
in case the imgResource "crop" value is a json string with variants.

Resolves: #82057
Releases: master, 8.7
Change-Id: Ibfc9f33ffc060992f22c1a3c7326990834f02ec4
Reviewed-on: https://review.typo3.org/53717
Tested-by: TYPO3com <>
Reviewed-by: Stefan Neufeind <>
Tested-by: Stefan Neufeind <>
Reviewed-by: Benni Mack <>
Tested-by: Benni Mack <>

Revision 96b4ad98 (diff)
Added by Wolfgang Klinger 7 months ago

[BUGFIX] Get the correct crop configuration for imgResource

This fix returns the right ImageManipulation\Area object
in case the imgResource "crop" value is a json string with variants.

Resolves: #82057
Releases: master, 8.7
Change-Id: Ibfc9f33ffc060992f22c1a3c7326990834f02ec4
Reviewed-on: https://review.typo3.org/55147
Tested-by: TYPO3com <>
Reviewed-by: Benni Mack <>
Tested-by: Benni Mack <>

History

#1 Updated by Markus Timtner 12 months ago

(there is a surplus "}" at the end of the typoscript, sorry for that - editing here in redmine sucks.)

#2 Updated by Josef Glatz 11 months ago

  • Related to Bug #71164: ImageManipulation Using in Page Resources Media Relation added

#3 Updated by Josef Glatz 11 months ago

  • Status changed from New to Accepted

I can confirm the issue

#4 Updated by Wolfgang Klinger 11 months ago

I tested with master and the output is

{"default":{"cropArea":{"height":0.661,"width":0.9745508982035929,"x":0.02245508982035928,"y":0.207},"selectedRatio":"NaN","focusArea":null}}

which looks fine, right?

#5 Updated by Markus Timtner 11 months ago

Yes, this output seems right.
So are you able to see the cropped image in the frontend?

#6 Updated by Wolfgang Klinger 11 months ago

and I tested with 8.7.5-dev

the output is:

{"default":{"cropArea":{"height":0.5,"width":1,"x":0,"y":0.086},"selectedRatio":"4:3","focusArea":null}}

#7 Updated by Wolfgang Klinger 11 months ago

I just want to nail down the cause ;-)
no, the image is not cropped, but the settings seem to be there … I'll investigate further.

#8 Updated by Wolfgang Klinger 11 months ago

  • Assignee set to Wolfgang Klinger

#9 Updated by Markus Timtner 11 months ago

if you need any help or testing, just contact me (@mtness) via slack -
I have a working test case ready here.

#10 Updated by Wolfgang Klinger 11 months ago

  • Related to Story #75880: Add art direction capabilities to BE added

#11 Updated by Gerrit Code Review 11 months ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53717

#12 Updated by Gerrit Code Review 11 months ago

Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53717

#13 Updated by Gerrit Code Review 11 months ago

Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53717

#14 Updated by Gerrit Code Review 11 months ago

Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53717

#16 Updated by Gerrit Code Review 11 months ago

Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53717

#17 Updated by Gerrit Code Review 11 months ago

Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53717

#18 Updated by Peter Kraume 9 months ago

The latest patch version works fine in production! Can we get this patch in the core soon, please?

#19 Updated by Gerrit Code Review 8 months ago

Patch set 7 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53717

#20 Updated by Benni Mack 8 months ago

  • Sprint Focus set to On Location Sprint

#21 Updated by Gerrit Code Review 8 months ago

Patch set 8 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53717

#22 Updated by Gerrit Code Review 8 months ago

Patch set 9 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53717

#23 Updated by Gerrit Code Review 8 months ago

Patch set 10 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53717

#24 Updated by Gerrit Code Review 8 months ago

Patch set 11 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53717

#25 Updated by Gerrit Code Review 8 months ago

Patch set 12 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53717

#26 Updated by Gerrit Code Review 7 months ago

Patch set 13 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53717

#27 Updated by Gerrit Code Review 7 months ago

Patch set 14 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53717

#28 Updated by Gerrit Code Review 7 months ago

Patch set 15 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53717

#29 Updated by Gerrit Code Review 7 months ago

Patch set 16 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/53717

#30 Updated by Gerrit Code Review 7 months ago

Patch set 1 for branch TYPO3_8-7 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/55147

#31 Updated by Wolfgang Klinger 7 months ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF