I am using the tx_news extension, included with an opengraph image.
This image is implemented with 500 x 258 pixel.
Where or how can I edit this values?
Facebook recommended 1200 x 630 pixel or a minimum of 600 x 315 pixel.
This is set in the Details/Opengraph partial.
<n:metaTag
property="og:image"
content="{f:uri.image(src:'{newsItem.firstPreview.uid}', treatIdAsReference:1, maxWidth:'500')}"
forceAbsoluteUrl="1" />
You can copy the default file from EXT:news/Resources/Private/Partials/Details/Opengraph.html to your website extension (or wherever you have you website files) and change it there. If you're using the default extension TypoScript, you can then set the TypoScript constant plugin.tx_news.view.partialRootPath to this location. For example, if you copy the file to EXT:website_mysite/Resources/Private/Partials/Extensions/news/Details/Opengraph.html, you need to set the constant to EXT:website_mysite/Resources/Private/Partials/Extensions/news/.
Related
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
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 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.
I might be overlooking this, but how can one get the size of a PDF if you're using FastPDFKit?
I'm trying to create PNG's from a pdf, but without knowing the actual dimensions of the page it's rather hard to get it right.
EDIT:
I searching in the documentation before, but all I found was this method:
- (void)getCropbox:(CGRect *)cropbox andRotation:(int *)rotation forPageNumber:(NSInteger)pageNumber withBuffer:(BOOL)withOrWithout
But I have no idea how to use it, it doesn't return anything.
Not sure how familiar you are with PDF, but each page specifies a number of "boxes" that are various rectangles of interest (crop, media, etc)
Most apps using PDF elect to use the crop box which defines the region of the page that should be displayed. (See section 10.10.1 of the PDF 1.7 specification: http://www.adobe.com/devnet/pdf/pdf_reference_archive.html)
Also of note is that a page can specify a rotation angle of 0, 90, 180, or 270 which you need to apply to the crop box yourself. (see /Rotate in table TABLE 3.27 of the PDF 1.7 spec)
So using the above API you would call it like so:
[somePDFDoc getCropbox:&cropbox andRotation:&rotation forPageNumber:10 withBuffer:NO];
This would give you the cropbox rect and it's rotation.
NOTE: I have never used FastPDFKit
NOTE2: If the value of cropbox is CGRectZero, you want to use one of the other rects. Most viewers use the media box instead.
I have a report designed with iReport 1.3.0. This report includes several images, which are loaded dynamically. Then I use JasperRunManager.runReportToPdfFile to create the PDF. Everything in the PDF looks fine except for the images, which appear scaled.
Can anyone tell me what am I doing wrong?
Thanks.
About Images
If you save the report as HTML, you will notice that the logo appears correctly.
Image files such as PNG are raster images: stored as individual pixels.
Whereas PDF files are primarily vectorized: the elements inside are stored as descriptions of how to draw them. This allows PDFs to scale and be legible at any size.
Using a raster image in a vector format will likely result in a pixelated effect.
Possible Solutions
You have a few options to make the images match the quality of the text, in order of ease:
Create a version of the logo at 1200 dpi, scaled 400% larger.
Create an SVG version of the logo.
Convert the image to a vector format.
Scale image 300% and change resolution to 288 dpi.
1200 DPI Version
The image will look sharp until around 400% zoom.
SVG Version
The image will look sharp at every resolution. Replace the normal <image...> XML with the following code (be sure to adjust the width and height accordingly):
<image hAlign="Center" vAlign="Middle">
<reportElement x="0" y="0" width="179" height="66"/>
<imageExpression class="net.sf.jasperreports.engine.JRRenderable"><![CDATA[net.sf.jasperreports.renderers.BatikRenderer.getInstance(new java.io.File("/path/to/logo.svg"))]]></imageExpression>
</image>
Convert GIF to SVG
To convert a GIF to SVG, first try a quick web-based tool, such as: http://vectormagic.com
Once converted to SVG, you will have to use the code listed above to display the logo.
Resolution and Scale
See:
https://stackoverflow.com/a/39320863/59087
http://www.webdevelopersjournal.com/columns/ajs_resolution.html
As of version 4.0.1 raster image resolution should be preserved and you can also improve the resolution of charts when using other export options (xls, rtf, html etc). The default is only a very low 72 dpi.
In iReport Options > JasperReport Properties edit
net.sf.jasperreports.image.dpi 300
http://jasperforge.org/projects/jasperreports/tracker/view.php?id=3411
In newer versions you need to configure the net.sf.jasperreports.image.dpi property globally by defining a jasperreports.properties file inside WEB-INF/classes/ folder with this line in it:
net.sf.jasperreports.image.dpi=300
A server restart is also needed.