I have an app that download some images from a server. Now app create a http post request for php script, that retrieve image (4 for each request) and sent it to my app into a json response (encoded in base 64). I put images into a ScrollView, and when user reach the end of the list, a new group of images is downloaded.
That is not the most perfotmant way, so i would use some LazyLoad libraries found on gitHub, but all of that require link to image, but i wouldn't sent in any way image link to app.
So, how can i do to retrieve images with lazy load?
Requesting images one by one or four by four does not make such a difference. In both cases you would first put a placeholder image in the imageview(s) and upon download complete and extracting done put the images in the respective imageviews if they do still exist. I suppose you put the downloaded and extracted images on the device so you can use them again when the user scrolls or starts the app again?
Related
I hope you are all doing great. My question is
I am using cantaloupe image server which serves images according to user specify parameters in url using IIIF image API v2.0
Here is the url.
https://iiif.blavatnikarchive.org/iiif/2/baf__be12495f1d825e832cd7b66f0ee30c8adda804cd6c19e627537107b714b95356/full/!1000,1000/0/default.jpg (1000x1000 image)
https://iiif.blavatnikarchive.org/iiif/2/baf__be12495f1d825e832cd7b66f0ee30c8adda804cd6c19e627537107b714b95356/full/!512,512/0/default.jpg (512x512 image)
Image server takes time to process image for user defined dimensions and region extraction around 4sec. Therefore what i am doing is to pre generating some thumbnails using image server and storing them on amazon s3 so if user requests same thumbnail again and again I serve them pre generated thumbnail. Two benefits
1- Image server not computing it every time and load on server will be low.
2- Image serving through static thumb will be faster because it is pre generated.
Problem is now actually two servers are involved.
1- Image server for dynamic content creation. https://iiif.blavatnikarchive.org
2- Amazon s3 buckets for static thumbnails which were pre generated. assets.s3.amazonaws.com/image-name
I want to serve images using one url so end user don't redirect to different locations for same image with different sizes. So i decided to serve images using API
https://api.blavatnikarchive.org/baf__be12495f1d825e832cd7b66f0ee30c8adda804cd6c19e627537107b714b95356/full/!512,512/0/default.jpg (Apache using php)
In my api I know which request is for static thumbnail and i need to take it from s3 bucket and which one is for dynamic size and need to take it from image server. In API i need to get image using file_get_contents("url of image whether its amazon s3 url or image server url") so request downloads it first on my api server and then serve to client and client browser downloads it again which is time consuming and takes around 2s for one image which is not acceptable. Image serving time should be less than a sec. I am here to know is there a way to map my api url directly to image server and amazon server.
Like
If user type https://api.blavatnikarchive.org/baf__be12495f1d825e832cd7b66f0ee30c8adda804cd6c19e627537107b714b95356/full/!1000,1000/0/default.jpg
It should map to https://iiif.blavatnikarchive.org/iiif/2/baf__be12495f1d825e832cd7b66f0ee30c8adda804cd6c19e627537107b714b95356/full/!1000,1000/0/default.jpg (1000x1000 image)
Or specify
https://iiif.blavatnikarchive.org/iiif/2/baf__be12495f1d825e832cd7b66f0ee30c8adda804cd6c19e627537107b714b95356/full/!512,512/0/default.jpg (512x512 image)
Should map to directly static image thumb
https://baf-iiif-assets.s3.amazonaws.com/be12495f1d825e832cd7b66f0ee30c8adda804cd6c19e627537107b714b95356
or you can suggest me solution how i can gather things to one url? I want to keep user on my api url and dont want to use any redirection. How can i achieve this?
Many thanks.
My question is about HTML and PHP.
This is my setup right now:
A website where user have accounts
A FTP server with pictures (currently none)
Files are currently saved on the website in the "PICTURES" folder (which is accessible by everybody who know the full URL)
So, I would like to know how I can display the images without storing them on the website (which will fix my URL problem).
My idea was to move the files on the FTP server, and when a users logon and request a page with those images, download them through a FTP connection, save them on the website, display the images, and remove them. Which would make them accessible only between the downloading time. But this solutions sounds REALLY bad to me.
You need always to have a place where your images are stored. But, if you don't want to give a user the chance to know where are stored, you can create a system which is used to show the images.
Think about this, if you want to download a file from Mega, you can't access to the URL where the file is stored, instead of that, the server itselfs calls a system who assign you a "key" and you can download the file only through that system using your "key".
You could use a system like "base64" so you can encode your image, and show it using it, or, you can use the "header" modifier so, you can display an image using a PHP code.
For example your image tag will be like:
<img src="processImage.php?id=01&user=10&key=123" />
So, your processImage will return a "tricky" image, actually not the image, but the code processed by PHP will be returned, like using "imagejpg()" function with the header "Content-Type:image/jpeg" and then the user will not know where the image is stored actually but the img will works actually.
So I'm working on a project to fetch images from fashion websites. Now I'm implementing the add item function in the website. In this function, user needs to input website url first, then the web scraper will scrape the target images' url and pass the urls to the curl to download the image. Finally the add item popup window will preview the images I fetched in the previous step and ask the user to fill out some basic information for the items. Everything works fine except that the curl will take a very long time to download the images (cuz the images from those fashion website are often very high-quality). So I'm wondering is there a way I can create a preview without actually downloading the full-size images and do the download when the user fill out basic information later. Thanks!
If the fashion website has smaller versions of the images, you should download those first. You can use them for your preview.
If the fashion website only has the full size image, there is no way to download a smaller version of it.
You probably know what your doing, but remember that you should respect the copyright of images on websites, especially art websites such as fashion websites. Be careful with what you do with them.
Setting up a live image stream on a website, using images from a webcam. Trying to work out the implementation of it. The webcam takes a picture and requires a crop, resize and upload (not necessarily in that order), before it is displayed to the user, with a new image every minute. Currently I have a php script that does the cropping and resizing, while a webcam program automates the picture taking and uploading. However...
Uploading directly over the existing image causes an issue if the user reloads the page while the upload is taking place, resulting in a missing image.
Uploading with a different filename, then renaming it causes an issue if the user reloads the page during the renaming, resulting in a combination of both images.
Using a sequential filename system then gets tricky with the webpage requiring to know the new upcoming file every minute, along with a potential backlog of images.
Any suggestions are appreciated. Hopefully I'm missing something simple.
Thanks.
Just upload your image with different name, set the current image name somewhere, either in config file or MySQL, and after upload change it.
I have a script where by users upload an image on a website and the image gets uploaded to an FTPServer. The name of the file is stored in a database, so when users click on a link, the query string is used as a reference in the Database to get the image name. The only part I'm stuck on right now, is how to display the image on my webpage using php. Is there a specific function to get a copy from the FTP server and display the image? I dont want do download the image to the web server, and then display the image and then delete it, as this could take up a lot of space if the web site has many visitors.
The "big image hosts" typically have web access to their "storage servers" as well. So when a file is uploaded to their image server it's accessible with a URL. You'd want to determine the url that points to the file you just uploaded and place that in your html (in the img tag. Let the user's browser retrieve the image, as opposed to your web server first retrieving it and then displaying the page.
You have to store the image on the web server, once you do that you can display it on your web page however you like, php, ajax, javascript, your choice.