Bug #58704
closedWhat does file:uid:contents do?
0%
Description
After reading data-type-gettext-file I was wondering, what file:ID:contents should do?
uid:46 is a valid image file.
page > page = PAGE page.10 = TEXT page.10.data = file:46:contents
and
page > page = PAGE page.10 = FILES page.10 { files = 46 renderObj = TEXT renderObj.data = file:current:contents }
gives me the following output.
<?xpacket begin="" id="W5M0MpCehiHzreSzNTczkc9d"?> <x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="XMP Core 5.1.2"> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> <rdf:Description rdf:about=""/> </rdf:RDF> </x:xmpmeta> <?xpacket end="w"?>
All other properties works correctly: name, size, sha1, extension, mime_types, publicUrl, localPath
Updated by Christian Stern over 10 years ago
Mah, sorry for the title. Should be: What does file:uid:contents do?
Updated by Georg Ringer over 10 years ago
- Subject changed from What does file: to What does file:uid:contents do?
Updated by Oliver Hader over 10 years ago
- Status changed from New to Needs Feedback
The "contents" property returns the actual contents of the file... Thus, internally file_get_contents() is called.
The XML/RDF you posted in your initial bug reports seems to be the data/contents of the file you uploaded.
Do you think documentation needs to be more specific on that?
I'm looking forward to your suggestion. Thanks in advance!
Updated by Christian Stern over 10 years ago
Oliver Hader wrote:
The XML/RDF you posted in your initial bug reports seems to be the data/contents of the file you uploaded.
No, it is not the content of my file. As I said: The file uid:46 is a valid image file. Works correctly with IMAGE, GIFBUILDER.
page > page = PAGE page.10 = TEXT page.10.data = file:46:contents page.30 = FILES page.30 { files = 46 renderObj = TEXT renderObj.data = file:current:contents }
This gives me the XML/RDF-Output again, but only once!
Than I tried this:
page > page = PAGE page.10 = TEXT page.10.data = file:46:name page.30 = FILES page.30 { files = 46 renderObj = TEXT renderObj.data = file:current:name }
This gives me the folloing output:
thefilename.jpgthefilename.jpg
This behavoiur exits on every image- and arbitrary binary-file that was tested. The XML/RDF-output is printed only once.
I tried the same with a text-file (uid:53). The content is: foobar
page > page = PAGE page.10 = TEXT page.10.data = file:46:contents page.30 = FILES page.30 { files = 46 renderObj = TEXT renderObj.data = file:current:contents }
The output is: foobarfoobar
Question: Is the something wrong about using image (binary)-files in file:current:contents?
Do you think documentation needs to be more specific on that?
Obviously not if contents is working correclty. :D
Updated by Christian Stern over 10 years ago
Oliver Hader wrote:
Do you think documentation needs to be more specific on that?
But if data-type-gettext-file contents is not working on binary files, it should be mentioned!
Updated by Oliver Hader over 10 years ago
I tried your TypoScript on my local environment (PHP 5.3.28, latest Git master of the TYPO3 CMS core) but unfortunately could not reproduce (full TypoScript is attached)
Can you please provide more information on your setup and system (PHP version, TYPO3 version or Git commit hash, Windows/Linux/Mac, information about the storage)? Thanks in advance!
page > page = PAGE page.typeNum = 0 page.10 = TEXT page.10.data = file:225:contents page.15 = TEXT page.15.value = --- page.20 = FILES page.20 { files = 225 renderObj = TEXT renderObj.data = file:current:contents }
Updated by Alexander Opitz about 10 years ago
- Status changed from Needs Feedback to Closed
No feedback within the last 90 days => closing this issue.
If you think that this is the wrong decision or experience this issue again, then please write to the mailing list typo3.teams.bugs with issue number and an explanation or open a new ticket and add a relation to this ticket number.