473,385 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Displaying photos in PHP

Hi,

We are building an internet based application that would allow any one
to purchase online (php generated) reports that include a few
photographs.

What is the best way to serve the images so that the user wouldn't get
hold of other images on the webserver?

Thanks in advance,
R Padala

Nov 22 '05 #1
1 1419
*** R Padala escribió/wrote (18 Nov 2005 07:23:48 -0800):
What is the best way to serve the images so that the user wouldn't get
hold of other images on the webserver?


Keep them in a folder out of the public folder tree and write a download
script to serve them.

If your web is under /home/foo/htdocs you can create /home/foo/pictures and
then write a script that:

1) Check credentials
2) Find picture's file name
3) Send appropriate "Content-Type" header
4) Read file and output it to browser

Some helpful functions:

mime_content_type()
getimagesize()
header()
readfile()
--
-+ Álvaro G. Vicario - Burgos, Spain
++ http://bits.demogracia.com es mi sitio para programadores web
+- http://www.demogracia.com es mi web de humor libre de cloro
--
Nov 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Ross | last post by:
Hi I have an application using asp.net that I am running on my PC. The web form has a text box where you can enter a name for a new Photo category then click on the button. The code is...
1
by: David Lozzi | last post by:
Hello, I'm wondering whats the best method to use for displaying several photos' thumbnails. One method I know is to dynamically resize the photo at the time the page is loaded. What does this...
4
by: Dave G | last post by:
Firstly, apologies as this is not strictly an Access problem. I have a Access 2003 database containing records about people, and each person has 2 photos associated with the record. The photos...
4
by: cheryl | last post by:
We are asked to create a website that can upload photos....Our website administrator must upload photos. His upoloaded photos must reflect on the users interface.. I dont know where and how to start...
2
by: =?Utf-8?B?TGlhbQ==?= | last post by:
My Photos folder opens automatically on startup and re-opens instantly when I close it. Occasionally a small black banner appears and disappears with the words "My Photos" on it. My Photos keeps...
1
by: JVFord | last post by:
Hello. We were having trouble displaying our photos (inserted as OLE Objects) in our database using Access 2003. (you can think of it as a contacts database where it housed info on the person and...
3
by: Walter Konopacki | last post by:
Having trouble displaying a jpeg in an Access 2003 form. Have read in Access Forms Dummy Book the an anomaly is present in Access 2003 that does not allow JPEG images to be displayed because Office...
1
by: David C | last post by:
I have an asp.net application that displays jpg photos in a datalist. The problem is that the photos are mostly 2576 x 1920 and around 1,100+ KB. Needless to say they take a long time to display. ...
1
by: jojo41300000 | last post by:
Hi, I am writing an application which will display the photos on the web pages. The photos are stored in the seperate machine but in the same LAN. First, when the user visit the web...
21
mikek12004
by: mikek12004 | last post by:
inside a <td> I display lots of fotos through AJAX according to what link the user pressed (enough to make my page scroll down) the problem is that in another page I have links to these photos the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.