I am using FOP version 1.0 to create PDFs. In one of the pages I'd like to display an image (2552 x 4200 pixel) and scale it down if it doesn't fully fit on the page. As far as I could see on the mailing list the recommended way of doing this would be following:
<fo:external-graphic inline-progression-dimension.maximum="100%"
content-height="scale-down-to-fit"
content-width="scale-down-to-fit"
src="..."/>
Unfortunately, that still doesn't display the whole image. The lower part of the image is cut off. Can anyone give me a hint on what I am potentially doing wrong?
I found this page here explaining how scaling works with XSL-FO.
Essentially, this is the snippet that I used to make it work:
<fo:external-graphic
src="url('...')"
width="100%"
content-height="100%"
content-width="scale-to-fit"
scaling="uniform"
xsl:use-attribute-sets="img"/>
I found that width="100%" was the missing piece in your own attempts. Hope this helps future visitors.
Defining the exact height and width of the "viewport":
.
If you don't specify the viewport then FOP won't know what to scale your image to.
It can guess, but not know precisely.
Related
I am programming a website in nuxt and to optimize the images I use nuxt-img.
By optimizing the site with Google Page Speed I saw that the performance value penalizes me because it marks me that the images I use on the site do not have an explicit "height" and "width" tag (see photo).
I set the width and height of the images via the class in the css because they must have relative width and height (eg%, vw, vh) and the height and width property of nuxt-img only accepts "px".
Anyone know how to fix? I don't find anything in the documentation
I have the following
<nuxt-img
id="imgl"
class="bn-img-left"
src="/team/TeamBW.webp"
loading="lazy"
sizes="sm:100vw md:50vw lg:100vw"
alt="Team Adapto bianco nero a sinsitra"
>
</nuxt-img>
Did you read that one? https://v1.image.nuxtjs.org/components/nuxt-img
This is how you define your images, you give it a value in w (pixels pretty much) or vw, then you can pass an aspect-ratio to it. But it's never fully responsive on both axes.
There are quite of articles on the web regarding that question: https://web.dev/learn/design/responsive-images/
That one is also interesting: https://jakearchibald.com/2022/img-aspect-ratio/
The idea is to provide various resolutions to the browser so that it can choose the closest one fitting the needs. Then, there will be some small differences caused by the weight difference (if an image fall in the middle of 2, size-wise).
I want to generate pdf's with jspdf. These pdf's are a summary of an registration that users make in my app with an picture and some notes.
However when generating a pdf I need to supply the height and width of the image. first of I don't know this (though I can figure it out) second if the dimensions are bigger then my pdf they won't fit. And if i just make them smaller the aspect ratio will be ruined.
I am kinda looking for a solution much like in html where you use things like 'width: 70vw; height: auto;'
Any idea's on how to fix this?
i have problems to obtain good thumb from some images, when the original images are striped or checked shirt.
With the magento's gd2 library resize() in Varien_Image_Adapter_Gd2 class (magento 1.5 version) i obtain an image with a strange effect that modify the aspect of real image.
I can't find the name of this effect, so i can't search this issue on google! :(
You can see my issue in these 2 images:
As you can see, on the thumb image there are some rolling strange lines in particular in top-left position.
The issue is more evident on checked shirt, so i have to find a solution to correct this.
If anyone have some tips on this issue, please said me! :)
thx
Luca
'Moire' is the pattern you describe and it is particularly visible due to use of 'gd2' library which may or may not use bicubic scaling.
I am not sure that #Guerra has understood the problem here, but, to me, it is a straightforward lack of bicubic (or better) scaling.
See the answer on this question and follow the link:
https://stackoverflow.com/a/255666/1617149
So you may want to scale your images for the frontend using imagemagick instead of the standard gd2 library that comes with Magento and use a filter.
You can run imagemagick through php (the proper way), or, if you have complicated image processing on the go, you can go commandline 'exec' and prototype your image processing that way. I don't have any ready-to-roll code for that, however, that is what you need: better thumbnail rendering than you get with gd2.
Try use cloudzoom, he autosize your images to fit on your needs.
http://ecommerce-team.com/cloud-zoom.html
how can you specify which image you want to show on when sharing an article? Now it just picks random images from our site which aren't relevant. I tried adding an image_src link to the head of my site but this didn't help. Any idea how you can do this?
The API of LinkedIn doesn't tell us how:
http://developer.linkedin.com/docs/DOC-1075
Kind regards,
Daan
There is currently no way to specify a thumbnail. They don't seem to use oEmbed, OpenGraph or image_src. However, you can trick it into picking a specific image.
Make your image 62x62 pixels (other sizes will likely work, but non-square aspect ratios failed for us in the combinations we tried). Also, make it the first IMG tag in the document.
If you don't want users to see that image on your site, you can hide it with postion:absolute and right:-999px.
Hello I am building a social network similar to facebook and I really need some help on how to handle the images in my website. I would like to know how sites like facebook manage the resizing of their images. An example would be looking at someones photo album. The length and width are not just simply changed. They are done in a more professional way to make the image still look clear and not stretched. Do they use a special tool for this. Another example would be profile pics when they are loaded to your message wall. Your friends profile pics are centered and cropped accordingly and then re sized. How do they go about doing this. Any help would be greatly appreciated.
They resize proportionally with an imaging library like GD, Imagick or others.
The presentation in the gray area is just that, presentation so HTML and CSS.
They stretch the images proportionally so that they don't look wrong; if you make the image 37.5% wider... you also make it 37.5% taller.
If we knew what language you are familiar with, we could probably suggest something to help with this.