[TYPO3-english] Page - Resource - add image in TYPO3 6.1.1 always saves value 1

Mark Kuiphuis typo3 at markyourweb.com
Tue Aug 27 07:32:25 CEST 2013


Hi all,

Finally I have been able to solve this problem. When you follow the 
instructions on the File Abstraction Layer Wiki page (#1), but instead 
of an IMAGE object, you use an IMG_RESOURCE object, you need to delete 
the line: file.import.override.field = media

As Philipp Gampe pointed out in this thread, an MM table is being used 
and as such the media field itself will store the amount of relations to 
this page. By having 1 image in the Resources Tab, this field will 
contain the value 1.

So having the line:

file.import.override.field = media

when you want to get the image from the levelmedia field, it actually 
always overrides this value with sys_file uid = 1

lib.topimage = IMAGE
lib.topimage {
file.import.data = levelmedia: -1,slide
file.treatIdAsReference = 1
file.import.listNum = 0
file.import.override.field = media
altText.data = page:title
}

I am using the following snippet of code to get my background image on a 
per page basis....

temp.headerData = IMG_RESOURCE
temp.headerData {
   file.import.data = levelmedia:-1,slide
   file.treatIdAsReference = 1
   file.import.listNum = 0
   stdWrap.wrap = <style type="text/css">html { background-image: 
url('/|'); }</style>
}
page.headerData.10 < temp.headerData

Just wondering though why the behaviour needs to be different for the 
IMAGE and the IMG_RESOURCE content objects?

Cheers, Mark

#1: 
http://wiki.typo3.org/File_Abstraction_Layer#How_to_use_.22levelmedia.22_with_6.x_.3F

On 25/06/13 8:22 PM, Mark Kuiphuis wrote:
> Hi all,
>
> I have recently upgraded a website from 4.7.12 via 6.0.4 to 6.1.1.
>
> The migration from /uploads/pics to /fileadmin/_migrated seemed to have
> gone fine, but when I would like to use the "Add media" functionality to
> add a resource to a page (to show a different background image for
> different pages) the value which is stored after selecting an image from
> the fileadmin is always 1.
>
> I have used the file.treatIdAsReference = 1, but this is only used for
> retrieving the value, not saving them..
>
> The site uses gridelements, fluidpages, fluidcontent and vhs, but this
> functionality does work on 4.7.12, just not on 6.1.1.
>
> Has someone experienced this as well on a 6.1.1. installation? (or in
> general with the new FAL?)
>
> Regards,
>
> Mark Kuiphuis



More information about the TYPO3-english mailing list