TYPO3 image rendering - typo3

I have TYPO3 10 and want to render the images in specific dimensions. I have a content element with only images, and these pictures are rendered with the dimension 495px x 331px. How can I change that? I've uploaded a much bigger original picture. The preview images are always in these dimensions. If I click on the image to enlarge it, it shows a much bigger picture.
The content element is a pictures only element with two columns.
When I set one column, the preview pictures are bigger. How is TYPO3 calculating the dimensions of the pictures?

I assume you want to know how to style the default content type "image".
This content type usually renders a gallery view (grid) of images.
First of all you have these options by default:
Selecting "Number of columns: 1" would make the image use a bigger space.
If you want to directly influence the HTML output, here are some pointers:
The default rendering engine of TYPO3 is fluid_styled_content.
Here is a guide how to override templates for a specific content type:
https://docs.typo3.org/c/typo3/cms-fluid-styled-content/10.4/en-us/Configuration/OverridingFluidTemplates/Index.html
That specific content type uses a GalleryProcessor:
https://github.com/TYPO3/TYPO3.CMS/blob/10.4/typo3/sysext/fluid_styled_content/Configuration/TypoScript/ContentElement/Image.typoscript
It renders this template:
https://github.com/TYPO3/TYPO3.CMS/blob/10.4/typo3/sysext/fluid_styled_content/Resources/Private/Templates/Image.html
... which uses some partials to render the media.
Media/Gallery sets up the layout for the image grid:
https://github.com/TYPO3/TYPO3.CMS/blob/10.4/typo3/sysext/fluid_styled_content/Resources/Private/Partials/Media/Gallery.html
Media/Rendering/Image finally renders the image. The value of dimension has been calculated by the GalleryProcessor:
https://github.com/TYPO3/TYPO3.CMS/blob/10.4/typo3/sysext/fluid_styled_content/Resources/Private/Partials/Media/Rendering/Image.html

Related

AEM6.4: Meaning of values in image map properties

AEM offers a plugin to create image maps for its internal inplace editor. After configuration the given values are stored into follow forrmat:
[rect(89,92,356,368)"/content/sites/we-retail/us"|"_blank"|"fdfdfdfdf"|(0.2,0.2004,0.8,0.8017)]
The first paratheses are defines the coordinates of choosen shape.
The content within the first quotaion signs defines the target site, within the second how to open it the browser. In the third pair of quotations sign contains an alternative Text for non images display.
What I don't know are the values in second paratheses. Does someone know for what these values stands for?
From the WCM core components Image model, they are called relative coordinates.
They are not standard HTML attributes and are instead populated as data attributes of the area tag within the image component.
See code below:
<area shape="${area.shape}" coords="${area.coordinates}" href="${area.href}"
target="${area.target}" alt="${area.alt}" data-cmp-hook-image="area"
data-cmp-relcoords="${area.relativeCoordinates}">
Since the map coordinates are fixed coordinates and do not change when the image scales in or not based on screen sizes, the image component’s JavaScript uses this relative coordinates data to adjust the coordinates of the map area whenever the image size is adjusted. This is handled by the resizeAreas() function within the component’s clientlib.

How to get cropped image dimensions in a Fluid template in Typo3 v8

Is there a way to get the actual image size (width/height) of a cropped image ("Image manipulation" > [Open Editor]) in a fluid template?
All I can come up with is {image.properties} and width and height. But these are the dimensions of the original resource, not the cropped one. And there is of course an attribute crop which holds all the crop info:
{"default":{"cropArea":{"height":0.6431784107946027,"width":0.608,"x":0.037,"y":0.15592203898050974},"selectedRatio":"NaN","focusArea":null}}
But do I really have to find a way to parse this in fluid (if that's even possible)? Isn't there an official way to calculate the actual dimension of a generated image?
My use case is an image gallery component for which I need to explicitly state the image dimensions.
In TYPO3 Fluid, You can crop image like below. See here
<f:image src="{image ogject}" alt="Landscape" width="100c" height="100c" />
You could use the VHS Media / SizeViewHelper https://fluidtypo3.org/viewhelpers/vhs/master/Media/SizeViewHelper.html
<f:format.bytes><v:media.size path="{f:uri.image(image: mediaElement, width: 600) -> v:format.trim(characters: '/')}" /></f:format.bytes>

TYPO3 image crop disable this function

TYPO3 crops the media files which were added as text & media. How can I disable this? I want that it uses the original file.
It always takes this:
fileadmin/_processed_/c/a/csm_herren2_b3373d24a3.png
Change the fluid template and remove the width and height attributes of the
Or maybe easier change the typoscript constant that define the max size to a higher value styles.content.textmedia.maxW = 600 and styles.content.textmedia.maxWInText = 300.

Drawing graphical objects (boxes and lines) inside a structured iText(Sharp) document (Chapters and Sections)

I'm creating a PDF document using iTextSharp, what I'm doing is generating all of my content in a c# List<Chapter> where the Chapters contain one or more Sections, and the Chapters have not yet been added to the document. I then enumerate through my List<Chapter> to generate a table of contents at the start of the document, and then add the Chapters to the document after my TOC.
That works great when my Sections contain text and images, but now I need to generate a Section containing boxes and lines. I don't want to draw my boxes and lines into an image and drop the image into the Section, that won't look as good as if I have actual PDF boxes and lines.
The Sections containing graphical elements can be intermixed with Sections containing text, so I need a way to add some kind of element to a Section such that that graphical Section works like text Sections in terms of going onto a new page only if necessary.
What's the best way to do this? I feel like it somehow involves PdfTemplates but I'm not sure how. Or maybe I need to create a PdfPTable and create my graphical elements in an IPdfPCellEvent?
You are on the right track when you want to involve PdfTemplate elements. PdfTemplate is an iText object that corresponds with the concept of Form XObjects in the PDF specification. We chose another name because the word Form is somewhat misleading (people confuse it with form fields, interactive forms, etc).
The content stream of a page in PDF is a sequence of PDF syntax, consisting of operands and operators. An XObject is an object that is external to this content stream. The content of an XObject is stored inside the PDF document only once, but it can be reused many times on the same page, on different pages.
There are different types of XObjects, but Image XObjects and Form XObjects are the most important ones.
Image XObjects are used when we work with raster images. You are absolutely right when you write: *"I don't want to draw my boxes and lines into an image and drop the image into the Section, that won't look as good as if I have actual PDF boxes and lines."
Form XObjects are used when we want to reuse PDF syntax. This is what you need: you want to define moveTo(), lineTo(), curveTo(), stroke(), fill(),... operations, and you want these lines and shapes to be stored as vector data.
The solution to your problem is to draw lines and shapes to a PdfTemplate object and to wrap the PdfTemplate object inside an Image object. When you add that Image object to a Section or a Chapter, it will be added as a Form XObject. You don't have to feat that it will be degraded into a raster image.
You can find some examples of this technique on the official web site. For instance in the answer to the question
How to generate 2D barcode as vector image?
Here we create a PdfTemplate with a bar code and we return it as an Image object. The screen shot that shows you the internals of the resulting PDF proves that the bar code is added as a vector image.
public Image createBarcode(PdfContentByte cb, String text,
float mh, float mw) throws BadElementException {
BarcodePDF417 pf = new BarcodePDF417();
pf.setText("BarcodePDF417 barcode");
Rectangle size = pf.getBarcodeSize();
PdfTemplate template = cb.createTemplate(
mw * size.getWidth(), mh * size.getHeight());
pf.placeBarcode(template, BaseColor.BLACK, mh, mw);
return Image.getInstance(template);
}
To create a PdfTemplate object, you need a PdfContentByte instance (e.g. using writer.getDirectContent()) and use the createTemplate() method passing a width and a height as parameters. Then you draw content to the PdfTemplate and turn it into an Image object using Image.getInstance().
You'll find more info on drawing lines and shapes in the chapter on Absolute positioning of lines and shapes and in the example section of Chapter 3 and Chapter 14 of my book.

Jasper Reports image and text mix

I want to write a jasper reports application. It has to arrange an image and a text such that they will be appropriately placed. This is what I want.
I get images and texts from a web service, so I can fetch image size on runtime. If its width is bigger the text should be below, and vice versa. I tried setting width option by a parameter, but it did not work.
How can i do it?
Correct: You cannot set the image width using a parameter.
The quickest solution is probably like this:
Determine what your maximum width is. Then use a 'Print when expression' to display either the picture-next-to-text layout or the picture-above-text layout. Your report will have 2 image elements and 2 text elements, but you'll choose which one to display based on the image size.
An alternative would be to investigate something like Dynamic Jasper. That's a project designed to dynamically generate the .jrxml on the fly, so it has the ability to modify the width similar to what you're describing.