OpenSeaDragon clear tiles cache - openseadragon

Please help me. How can I clear tiles cache.
I'm using customTilesSource and changing paramenters of image "on fly" and need redraw viewer.
By API in TileCache there isnnt direct method for clear all cache.
For using clearTilesFor(tiledImage) I need to know tiledImage, but I dont know how to get tiledImage

To clear all tiles for all images do viewer.world.resetItems().
http://openseadragon.github.io/docs/OpenSeadragon.World.html#resetItems

Related

How to force to show image orientation?

I'm using multer node and express to upload a image to my app. But some images shows rotate 90 degrees when it's on the client.
why is this happening?, how can I fix it?
By the way I'm using vue on the client and for the upload process, of course I use formdata
UPDATE
After research and comments from the guys above, its a EXIF problem. Any code ideas to solve this?
The behaviour you are experiencing is probably caused by the Exif Orientation metadata.
There is another question here on Stackoverflow about this problem: JS Client-Side Exif Orientation: Rotate and Mirror JPEG Images
The selected answer points to a project called Javascript-Load-Image as a possible solution, that basically means you will have to take the orientation in consideration when rendering the images to get a consistent behaviour.
Another possible alternative would be to edit/remove the orientation metadata in your backend.
Check the following resource for more information:
JPEG Image Orientation and Exif
This is most likely caused by Exif metadata (just like #Romulo suggested).
Browsers ignore Exif metadata when displaying images and that's why you're getting this behaviour.
To check that this is related to Exif take 4 pictures with different phone orientation (landscape left, landscape right, portrait, upside down). One of them will be shown properly, while the other 3 will be rotated. (Also note that if you're using the front camera, the image will also get mirrored).
Not all camera phones do this, but iOS does it consistently. The reason for this is performance. When rotation the phone the sensor also rotates and the picture taken doesn't take the rotation into consideration.
To properly show the photo, the image needs to be rotated, but if you just change the Exif metadata then you don't need to do it. Of course, any client that shows the image needs to be aware of this information (and iOS Photos and such are aware).
This has nothing to do with multer, but with the images are stored.
The bottom line is that you need to rotate the image to compensate for this.
Take a look over this npm package to adjust your image on the server side.

Is there a way to make an image displayable in one website only?

I need to make a website with an private image inside of <img /> tag, which mean you cannot view it any where outside that website. I need the image to not be displayed even if the user try to copy the src of the image and open it in another tab of the same browser.
Is it possible? If so, how can i achieve that?
Short answer: no. Long answer: not possible :-)
If you can get at it in any way (and you must be able to do that to get it to render in a browser), you can save it locally.
All someone would have to do is access it with a munged copy of a browser that saves all incoming data to disk.
There are ways to obfuscate the image so that the user won't be able to just copy and paste the URL, you can use the Javascript Image object to create a new image and drawImage to draw it into a canvas, however you'll still need to obtain the image data somehow, perhaps making an ajax request for the actual image on the server. However a really persistent user can inspect your javascript code and do some reverse engineering to get the image source.
A more naive user will just take an screenshot of the image and achieve the same effect.
So any attempt to try to prevent the user from copying the image is futile.

How can I capture an Image for post processing in OSG

I need to capture an Image from my viewer and need to do some post processing and display it back on it.
Right now am more interested in the first part of it. That is to capture Image from the viewer.
While going through the OSG I came across ScreenCaptureHandler.
But am not able to get an Image out of it.
I am still working to get it done but in case any of you have any other way of how it can be done or an Example for screencapturehandler that you can share.
To capture the rendered view into an image I use a custom osg::Camera::DrawCallback.
To capture the view at any point, set the drawCallback on the camera, force rendering, restore to a NULL callback.
Notice that the following code is part of a member function of a custom viewer (that's probably not your case):
osgViewer::View::getCamera()->setFinalDrawCallback(new ViewCaptureCallback(img));
osgViewer::Viewer::renderingTraversals();
osgViewer::View::getCamera()->setFinalDrawCallback(NULL);
The ViewCaptureCallback basically uses image->readPixels() to read from the backbuffer.
glReadBuffer( GL_BACK );
osg::GraphicsContext* gc = renderInfo.getState()->getGraphicsContext();
// Here you should process the backbuffer's size and format
image->readPixels(0, 0, gc->getTraits()->width, gc->getTraits()->height, pixelFormat, GL_UNSIGNED_BYTE);
Hope it helps

set a image in browser cache

Is there any way to set image in browser's cache? I am googing, but I couldn't find anything. If setting image at cache is possible, please give me the right direction.
try this
img2=new Image();
img2.src="landscape3.gif";
function changeImage()
from http://www.w3schools.com/dhtml/tryit.asp?filename=trydhtml_image_preload

Is there a way to lazyload images before they become visible in the viewport using mod_pagespeed?

I configured my .htaccess to lazyload images using mod_pagespeed, but I don't want to affect the user experience by showing an image that is not loaded yet.
Is there a way to set a configuration and lazyload images some pixels before they become visible in the viewport using mod_pagespeed?
If you enable image lazy-loading in mod_pagespeed, the default behavior is to load images on "on scroll". We do have existing code paths to change this to "onload" - aka, load images after onload has fired, but unfortunately we haven't yet exposed it as a configuration flag. A feature for one of the upcoming releases! :-)
Current filter documentation:
https://developers.google.com/speed/docs/mod_pagespeed/filter-lazyload-images
Unfortunately, there is no current way to add an "offset" to when lazyload starts loading the image. It's currently set to the bottom of the viewport, and no option is exposed to configure this. However, I think this would be a valuable option to expose, and I've recorded your feature request at https://code.google.com/p/modpagespeed/issues/detail?id=644.

Resources