I'm using Next.js 10.0.7 and next-images 1.7 and big images take some seconds to appear.
I'm using the components correctly, you can see bellow, but I think that there is a solution to my problem.
<Image
height="600"
width="800"
src={
'https://myImageURL.png'
}
alt="my image"
/>
Some questions:
If I convert all images to .webp images is be showned faster?
Is there a solution to this problem?
I've been having trouble with the same issue, mostly in Slider components. Basically, because the image is off-screen until the Slider moves it into view, there is a delay and it doesn't show for a short time, which looks nasty.
Solution:
Add the sharp package.
The problem comes from the default image processor that NextJS uses. I don't know if this is good for OP, but in my case, I hadn't fully read the docs. There is a tip that states:
The next/image component's default loader uses the 'squoosh' library for image resizing and optimization. This library is quick to install and suitable for a dev server environment. For a production environment, it is strongly recommended that you install the optional sharp library by running
yarn add sharp
in your project directory. If sharp is already installed but can't be resolved you can manually pass the path to it via the NEXT_SHARP_PATH environment variable e.g. NEXT_SHARP_PATH=/tmp/node_modules/sharp
After adding sharp, my images were processed much faster and there is no noticeable delay anymore. I would try adding this before adding priority={true} to every image, as that will impact the site performance.
The problem is that the default behavior of the Image Component is lazy loading. You can change this behavior to eager by either adding the loading prop like this: loading="eager" or by adding priority={true}.
The recommended way is using priority.
About the image format. Webp is smaller than png, so it will load faster.
upgrade your next higher than 11.0.2-canary.20
yarn add sharp
beer
https://github.com/vercel/next.js/issues/23637#issuecomment-885631610
https://nextjs.org/blog/next-11-1#image-optimization
Related
After installing and configuring a few plugins to optimize the cache and increase my score, my images refuse to appear on client pages. Even in the library they are not displayed. however the links of his images are very real and they lead to the images in the folder. I then uninstalled these plugins and clear the cache but still nothing.
Here are the plugins:
GT metrix
WP fastest cache
Shortpixel image optimize
Lazy load - optimize images
Lazy load - optimize images
Hey Giovani, this is probably messing up something, you should just remove it. (Just a wild guess, with no code nor link to your website, no wizards tricks)
Lazyloading has since been incorporated as a default feature on most major web browsers.
You can use loading="lazy" in you image tag <img src"" alt="" loading="lazy" >
No library needed, by using loading="lazy" if an image need to be lazy loaded, the browser knows it and will to it by default
https://web.dev/native-lazy-loading/
https://caniuse.com/#feat=loading-lazy-attr
Hope this will help you
I am trying to implement Retina.js plugin for displaying alternate images on retina display. This will certainly work if I have a fixed image path hardcoded into the page or theme but how do I make this work through the Image block? Or is there a better alternative to this?
That library sounds a little heavy handed in just pinging your server for every single image. However, if you include it in the page it should work just fine.
One thing to keep in mind is that by default concrete5 uses the <picture> tag to output from the image block. Any library you use should have compatibility with that tag.
If you end up using a library that requires you output the image differently, I'd recommend creating a custom \Concrete\Core\Html\Image subclass and binding it to the container in you /application/bootstrap/app.php file:
<?php
$app->bind('html/image', \My\Custom\Image::class);
I want to allow the user to crop and image using Jcrop. I've installed the jquery-jcrop smart package, and patched it to include the css and gif files (see my pull request on that project).
Now things look good, but once the user clicks/drags on the image, he can never let go. From the first drag (or even a click), he is able to adjust the size of selection, but releasing the mouse button does nothing, and every mouse movement continues to change the selection size.
To reproduce:
1. mrt create tmp
2. mrt add jquery-jcrop
3. in tmp.html <body>:
<img src="https://www.filepicker.io/api/file/sOrqCDfqSbqkkHbbu1pC"
id="target" />
4. in tmp.js isClient:
Meteor.startup(function() {
$('#target').Jcrop();
});
Running mrt now and accessing the page will show the desired behaviour (might look weird though without the patch from the pull request mentioned above).
Stopping, running "mrt add bootstrap", rerunning will show the problem as described above.
I should note that a non-Meteor project, with jquery, jquery-jcrop and bootstrap works without problems.
ok I tracked the problem down to the bootstrap.js in Bootstrap 2.3.0. Replacing with Bootstrap 2.3.1 fixes the problem. I reviewed the Bootstrap Changelog and don't really see the relevant change, but this works :)
We've reached the end of our tether here trying to overcome a nasty and intermittent FOUC in Firefox 3.5.x+ for a new release we're working on.
We've tried:
Disabling Javascript in FF
Using Quirks mode rendering by removing the DOCTYPE
Moving from #import for additional CSS to <link>
Switching concatenation on and off
Removing CSS files from the concat, one at a time
Switching the local cache off in Firefox
etc
Our previous release never exhibited any FOUC issues, so it's something we've done to this release. Changes we've made so far include:
Using Base64 encoded images over Data URIs for all decorative imagery, served via CSS.
Separating 'framework'-related CSS files from page-specific CSS and bundling them as two separate CSS files
To recreate the problem... use Firefox 3.5.x or 3.6.x, then:
Head on over to: http://my.publisher-subdomain.env.yola.net/
Login with username: 'stack#yola.com' and password: 'stackoverflow'
Once logged-in, you should be at http://my.publisher-subdomain.env.yola.net/sites/
Click the Account link in the main nav.
The Account page should load, and you should see a FOUC. If the FOUC does not occur, clear your cache and reload the page.
Your help would be greatly appreciated! :)
UPDATE:
The dev environment is still exhibiting the FOUC, but only if FireFox is running low on memory or has a lot of extensions installed. Latency and rendering speed definitely affect the visibility of this FOUC.
Although this is a very old question, I found it when I was searching for a solution to the same problem. So, I wanted to post the solution for future reference. I just needed to move the reference to my CSS files above the references to external Javascript that needed to be in my header.
I can be wrong, but this could be a concurrent connections issue. According to my Firebug's "Net" tab
the HTML page simply takes a lot of time to load - maybe also because it is on a development server? - and the style sheet gets loaded after the HTML page.
I can't claim to entirely understand what's happening here, but I would try putting the style sheet onto a different domain as a first measure. That should make Firefox establish a connection straight away.
It would probably also be a good idea to go back to normal images instead of data: URIs - that would reduce the size of the style sheet, and data: URIs won't work at all in IE < 8.
I'm having an issue where certain controls are flipped, depending on the machine that I'm building my project on. On my development machine, when I build it, everything is okay. However, when I build it on our build server, some things are flipped. It seems to be things that are on a higher layer - for instance, options in the select control (see first image below), alerts/overlays (see second image below), etc. It's not just the text, either - the entire content is flipped, images and all.
I have verified that the code is exactly the same in both instances, so it must have something to do with settings or the flex SDK version. On my development machine, the Flex SDK version is 4.0.0.14159, and on the build server, the Flex SDK version is 4.1.0.16076. I can downgrade the SDK on the build server if needed - but could it really be an issue with the SDK? Any ideas?
Thanks!
It looks like this will be fixed in the 4.5 SDK--see SDK-26473 for workarounds.
I was able to fix the mirroring by turning off Flex 3 Compatibility Mode in the Flex compiler settings (if using mxmlc, -compatibility-version=4.0).
Your build machine must be set to a locale which uses right-to-left text, such as Hebrew or Arabic keyboard setting.
Oops - hadn't read all of dpstone's answer before I posted my comment to the question.
The answer to this problem is in the bug he linked to. You need to explicitly set the layout direction. You can do this in one of two ways.
1) in a .css file that you import into your main application file:
global
{
layoutDirection: "ltr";
}
OR
2) you can set it in a <style> tag in your main application file.
<mx:Style>
global
{
layoutDirection: "ltr";
}
</mx:Style>