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.
Related
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.
I am getting the image links where my image is there by using reverse image search provided by google but now we want the exact path of that page where my particular image is situated like http://www.indiamart.com/lelijiye-bengaluru/maroon-color-desginer-saree.html page
Direct linking is the use of a particular image or multimedia file on another website by linking directly to it on another web host's server. (I use Photobucket)
For example, if you want to post an image on another forum, a direct linking URL (found on the edit image page) can be used to display that image via the PBase server on another website or forum.
An easy way to find the direct linking URL for your images is to go to the edit image page and see the 'direct linking URL' at the top right of the screen.
I have a script that displays the images via php. www.maindomain.com/image.php?img=test.jpg serve images, and i have other sites, where these images are displayed like this
<img src="www.maindomain.com/image.php?img=test1.jpg">
But this script, for show image is on my www.firstsite.com and www.secondsite.com. Is posibble to log which site is showing image? (put it to database for example).
I know, i can use $_SERVER['HTTP_REFERER'] but it's not 100%. Any other ideas?
The only 100% failsafe way to do it is to share the same image with different URLs. F.i. www.maindomain.com/image.php?test1.jpg&ref=first and www.maindomain.com/image.php?test1.jpg&ref=second. As actually this images are not requested by first or second servers but by visitor's browsers. Having different GET params in URL makes it easy to log data you need.
I had trouble finding an answer for this problem. I would like to display a link to a page that has a video file on it but I don't want the link to appear until after the video file is uploaded.
It's a site where users upload videos so I don't want to have to manually put the links there for them after they upload their videos, nor do I want to make the links ahead of time since users will click them and there will be no video available.
So, is there a way to keep a link hidden until a file is uploaded. Once the file is uploaded the php page where the link will be on checks to see if it exists and then if it does the link is shown, otherwise the link stays hidden.
Each time the form that the client uses to upload a file is sent store the information of the file in a database.
Each time the client request the list of videos, query the database and build the web page based on the results.
Make sure to associate the uploaded files to the users, so you don't mix the up. Are you managing authentication already?
If you want to have the links appear as soon as the upload is finished without reloading the page, then you need ajax.
For now, i am able to download the image that i uploaded into my server. My upload is using php script to file open a image to store the .jpg file in the server. But i want to know how to retrieve the new image from my server to my android application. What i meant is every time the user upload the image, the image will replaced the old image file (using the same file name) in my server folder.
When i reload the image in my application, it still gives me the old image even though the image not longer exist. Later i found out that i need to go the url and refresh the image then the new image will be loaded in the android application. I want to know how can i refresh the url without using the browser to refresh the image every time the user upload new image. Thanks!
My question might not be clear/good but i really needed help and im new to android development
A pragmatic approach: When the user uploads a file, also make a txt/xml-file with the current date in it.
Make you Android application poll the txt/xml-file. Store the date in the txt/xml-file (in a database). When polling verify if the date in the file is newer then the one you stored. If it's newer, download your image.
After successfully replaced on server,you have to get url of new uploaded image as response & replace old url by new url.