Displaying user data and picture
Displaying user data and picture
am 06.08.2009 03:47:53 von nashrul
I am new to php...
I try to make a php page that displays form submitted data and image. There
are 3 php files,
tampil_tamu_admin.php, edit_tamu.php and display_img.php.
The user lists are displayed in the tampil_tamu_admin.php, and when the user
clicks one record, it shows edit page (edit_tamu.php) that display user data
and picture. (edit_tamu.php file includes img tag that calls display_img.php
with user id)
The problem is the user data is displayed but the image is not displayed...
How can I display this image ?
The codes are attached
Thanks http://www.nabble.com/file/p24839092/guest-book.rar guest-book.rar
http://www.nabble.com/file/p24839092/guest-book.zip guest-book.zip
--
View this message in context: http://www.nabble.com/Displaying-user-data-and-picture-tp248 39092p24839092.html
Sent from the PHP - General mailing list archive at Nabble.com.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Displaying user data and picture
am 06.08.2009 15:45:30 von Ralph Deffke
hi there,
u want help? break down ur question to the point, none is going to downlod
unknown zips searching for the spot.
its fun to help, but its for free, so make it easier for us to help u
u r lucky that i'm sick at the moment and a bit bored, but anyway i'm not
downloading a zip.
however, the most common error for newbies on that issue is, that thex don't
pay attention to the fact that a browser treats a picture as a separate file
to download. u can store pictures in a databas, and a blob field in mysql is
the right thing, however u have to have a little php scrip, however with a
..png extention to get the browser displaying the picture.
u have to tell apache that a .png (or jpeg, gif etc) extention is to be
parsed by the php interpreter where u then can place ur database retrival of
the picture. in that script u then have to make shure ur are sending the
right header out.
to give u all the details is worth some time and time is money. the amount
of documentation to figure out the details is not small. start with some w3c
and rfc standard to get the clue.
regards
ralph
ralph_deffke@yahoo.de
"nashrul" wrote in message
news:24839092.post@talk.nabble.com...
>
> I am new to php...
> I try to make a php page that displays form submitted data and image.
There
> are 3 php files,
> tampil_tamu_admin.php, edit_tamu.php and display_img.php.
> The user lists are displayed in the tampil_tamu_admin.php, and when the
user
> clicks one record, it shows edit page (edit_tamu.php) that display user
data
> and picture. (edit_tamu.php file includes img tag that calls
display_img.php
> with user id)
> The problem is the user data is displayed but the image is not
displayed...
> How can I display this image ?
>
> The codes are attached
>
> Thanks http://www.nabble.com/file/p24839092/guest-book.rar guest-book.rar
> http://www.nabble.com/file/p24839092/guest-book.zip guest-book.zip
> --
> View this message in context:
http://www.nabble.com/Displaying-user-data-and-picture-tp248 39092p24839092.html
> Sent from the PHP - General mailing list archive at Nabble.com.
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Displaying user data and picture
am 06.08.2009 15:57:51 von Martin Scotta
http://php.net/header
take a look at the comments sections, there are a lot of examples of
how to send an image to a browser, only think that instead of a file
your are using a blob database field
On Thu, Aug 6, 2009 at 10:45 AM, Ralph Deffke wrote:
> hi there,
>
> u want help? break down ur question to the point, none is going to downlod
> unknown zips searching for the spot.
>
> its fun to help, but its for free, so make it easier for us to help u
>
> u r lucky that i'm sick at the moment and a bit bored, but anyway i'm not
> downloading a zip.
>
> however, the most common error for newbies on that issue is, that thex don't
> pay attention to the fact that a browser treats a picture as a separate file
> to download. u can store pictures in a databas, and a blob field in mysql is
> the right thing, however u have to have a little php scrip, however with a
> .png extention to get the browser displaying the picture.
>
> u have to tell apache that a .png (or jpeg, gif etc) extention is to be
> parsed by the php interpreter where u then can place ur database retrival of
> the picture. in that script u then have to make shure ur are sending the
> right header out.
>
> to give u all the details is worth some time and time is money. the amount
> of documentation to figure out the details is not small. start with some w3c
> and rfc standard to get the clue.
>
> regards
> ralph
> ralph_deffke@yahoo.de
>
>
> "nashrul" wrote in message
> news:24839092.post@talk.nabble.com...
>>
>> I am new to php...
>> I try to make a php page that displays form submitted data and image.
> There
>> are 3 php files,
>> tampil_tamu_admin.php, edit_tamu.php and display_img.php.
>> The user lists are displayed in the tampil_tamu_admin.php, and when the
> user
>> clicks one record, it shows edit page (edit_tamu.php) that display user
> data
>> and picture. (edit_tamu.php file includes img tag that calls
> display_img.php
>> with user id)
>> The problem is the user data is displayed but the image is not
> displayed...
>> How can I display this image ?
>>
>> The codes are attached
>>
>> Thanks http://www.nabble.com/file/p24839092/guest-book.rar guest-book.rar
>> http://www.nabble.com/file/p24839092/guest-book.zip guest-book.zip
>> --
>> View this message in context:
> http://www.nabble.com/Displaying-user-data-and-picture-tp248 39092p24839092.html
>> Sent from the PHP - General mailing list archive at Nabble.com.
>>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
Martin Scotta
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Displaying user data and picture
am 06.08.2009 23:02:55 von Michael Peters
Ralph Deffke wrote:
> and a blob field in mysql is
> the right thing, however u have to have a little php scrip, however with a
> .png extention to get the browser displaying the picture.
What is the advantage to storing an image in the database opposed to as
a flat file?
It seems to me it would require an extra database call, which could be
cached but the cache would then grow to a monster size for sites with a
lot of images.
Flat file involves a filesystem call, the disk arm has to move, but
files on the server that have recently been read are still in the
servers memory cache (at least with Linux) and do not require disk arm
movement. Database calls that are not cached also require disk arm movement.
I ask not to criticize the procedure, but to find out if it is really
worth it.
My web app does not store images in the web root so php already is
invoked to open the file, read it, sometimes manipulate it (add a server
side watermark), and then send it. It reads the data from flat file.
I don't have any data blobs in my database - which makes incremental
backups easier - I use rsync for files and do a nightly mysql dump.
Except for the first of the month, the diff of that nights backup
compared to first of month is saved to flat file for rsync. Binary blobs
in the database would likely mean I have to change my backup protocol,
but if it really is advantageous, I'd do it.
I do store information about the images in the database, but that's
rather small and easily cached by APC w/o needing to allocate too much
memory to APC. Add data blobs and the cache would explode in size.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
AW: Displaying user data and picture
am 06.08.2009 23:16:58 von Ralph Deffke
--0-1331670426-1249593418=:17483
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
I did mean, if u want to store a image in the database it would be a blob f=
ield, a blob field is a indifidual file in the database anyway,
I mean=
if i would do that type of design i would store the path to the image file=
in the database and give the browser the path to it for download.
how=
ever there are some reasonable reasons to store a image in the database.=0A=
1. if u have no access to write files to the disk this is the case in most =
free hosting services they give u php and mysql and thats it=0A2. if u want=
some access control to the image, e.g. login controlled. server admins don=
t like u playing arround with the htaccess file=0A3. its easy in those and =
other cases=0A4. image directores are public, and apear in search engines=
=0A________________________________=0AVon: Michael A. Peters
peters@mac.com>=0AAn: Ralph Deffke =0ACC: php-genera=
l@lists.php.net=0AGesendet: Donnerstag, den 6. August 2009, 23:02:55 Uhr=0A=
Betreff: Re: [PHP] Displaying user data and picture
Ralph Deffke wrote=
:=0A> and a blob field in mysql is=0A> the right thing, however u have to =
have a little php scrip, however with a=0A> .png extention to get the brows=
er displaying the picture.
What is the advantage to storing an image i=
n the database opposed to as a flat file?
It seems to me it would requ=
ire an extra database call, which could be cached but the cache would then =
grow to a monster size for sites with a lot of images.
Flat file invol=
ves a filesystem call, the disk arm has to move, but files on the server th=
at have recently been read are still in the servers memory cache (at least =
with Linux) and do not require disk arm movement. Database calls that are n=
ot cached also require disk arm movement.
I ask not to criticize the p=
rocedure, but to find out if it is really worth it.
My web app does no=
t store images in the web root so php already is invoked to open the file, =
read it, sometimes manipulate it (add a server side watermark), and then se=
nd it. It reads the data from flat file.
I don't have any data blobs i=
n my database - which makes incremental backups easier - I use rsync for fi=
les and do a nightly mysql dump. Except for the first of the month, the dif=
f of that nights backup compared to first of month is saved to flat file fo=
r rsync. Binary blobs in the database would likely mean I have to change my=
backup protocol, but if it really is advantageous, I'd do it.
I do st=
ore information about the images in the database, but that's rather small a=
nd easily cached by APC w/o needing to allocate too much memory to APC. Add=
data blobs and the cache would explode in size.
--0-1331670426-1249593418=:17483--
Re: Displaying user data and picture
am 06.08.2009 23:48:19 von Andrew Ballard
On Thu, Aug 6, 2009 at 5:02 PM, Michael A. Peters wrote:
> Ralph Deffke wrote:
>>
>> Â and a blob field in mysql is
>> the right thing, however u have to have a little php scrip, however with=
a
>> .png extention to get the browser displaying the picture.
>
> What is the advantage to storing an image in the database opposed to as a
> flat file?
>
> It seems to me it would require an extra database call, which could be
> cached but the cache would then grow to a monster size for sites with a l=
ot
> of images.
>
> Flat file involves a filesystem call, the disk arm has to move, but files=
on
> the server that have recently been read are still in the servers memory
> cache (at least with Linux) and do not require disk arm movement. Databas=
e
> calls that are not cached also require disk arm movement.
>
> I ask not to criticize the procedure, but to find out if it is really wor=
th
> it.
>
> My web app does not store images in the web root so php already is invoke=
d
> to open the file, read it, sometimes manipulate it (add a server side
> watermark), and then send it. It reads the data from flat file.
>
> I don't have any data blobs in my database - which makes incremental back=
ups
> easier - I use rsync for files and do a nightly mysql dump. Except for th=
e
> first of the month, the diff of that nights backup compared to first of
> month is saved to flat file for rsync. Binary blobs in the database would
> likely mean I have to change my backup protocol, but if it really is
> advantageous, I'd do it.
>
> I do store information about the images in the database, but that's rathe=
r
> small and easily cached by APC w/o needing to allocate too much memory to
> APC. Add data blobs and the cache would explode in size.
>
This is a very old, sometimes hotly debated question. Google around a
bit and you'll find lots of discussion on the pros and cons of each
approach. It usually comes down to a design decision (or developer
preference) trying to balance the benefits from both approaches.
Sometimes you'll even find hybrid solutions that try to get the best
of both worlds.
Sometime, you don't have much of choice, though. For instance, some of
the sites I manage are split, with the administrative interface on a
private intranet hosted on a server that is almost totally isolated
from the public-facing web servers that use the same information. In
this case, network policy prohibits us from mapping a common location
that both machines could access. Since the network policy is unlikely
to change, and since both systems have access to the database, that is
the easiest place store images and/or documents that need to be
accessible to both.
Andrew
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Displaying user data and picture
am 07.08.2009 00:05:26 von Ben Dunlap
> I don't have any data blobs in my database - which makes incremental
> backups easier - I use rsync for files and do a nightly mysql dump.
> Except for the first of the month, the diff of that nights backup
> compared to first of month is saved to flat file for rsync. Binary blobs
> in the database would likely mean I have to change my backup protocol,
> but if it really is advantageous, I'd do it.
This is just an aside but are you aware of the '--hex-blob' argument to
mysqldump? It causes binary data to be dumped as a hexadecimal string:
http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option _mysqldump_hex-blob
It's space-greedy (every byte in your original data requires two bytes in the
dump file) but it seems like it would be compatible with your mysqldump/diff
approach.
Ben
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Displaying user data and picture
am 07.08.2009 00:41:12 von Phpster
On Aug 6, 2009, at 5:02 PM, "Michael A. Peters" wrote:
> Ralph Deffke wrote:
>> and a blob field in mysql is
>> the right thing, however u have to have a little php scrip, however
>> with a
>> .png extention to get the browser displaying the picture.
>
> What is the advantage to storing an image in the database opposed to
> as a flat file?
>
> It seems to me it would require an extra database call, which could
> be cached but the cache would then grow to a monster size for sites
> with a lot of images.
>
> Flat file involves a filesystem call, the disk arm has to move, but
> files on the server that have recently been read are still in the
> servers memory cache (at least with Linux) and do not require disk
> arm movement. Database calls that are not cached also require disk
> arm movement.
>
> I ask not to criticize the procedure, but to find out if it is
> really worth it.
>
> My web app does not store images in the web root so php already is
> invoked to open the file, read it, sometimes manipulate it (add a
> server side watermark), and then send it. It reads the data from
> flat file.
>
> I don't have any data blobs in my database - which makes incremental
> backups easier - I use rsync for files and do a nightly mysql dump.
> Except for the first of the month, the diff of that nights backup
> compared to first of month is saved to flat file for rsync. Binary
> blobs in the database would likely mean I have to change my backup
> protocol, but if it really is advantageous, I'd do it.
>
> I do store information about the images in the database, but that's
> rather small and easily cached by APC w/o needing to allocate too
> much memory to APC. Add data blobs and the cache would explode in
> size.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
I can tell you from painful persoanl experience that most database
tend to start having performance issues after 7-10gb of files are
stored in the table. Horrendous access times start to have big impacts
on the application.
We moved all of our clients to file based storage an just keep the
link in the table. This also reduced the size of the backups as well
Bastien
Sent from my iPod
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Displaying user data and picture
am 07.08.2009 02:08:21 von Michael Peters
Ben Dunlap wrote:
>> I don't have any data blobs in my database - which makes incremental
>> backups easier - I use rsync for files and do a nightly mysql dump.
>> Except for the first of the month, the diff of that nights backup
>> compared to first of month is saved to flat file for rsync. Binary blobs
>> in the database would likely mean I have to change my backup protocol,
>> but if it really is advantageous, I'd do it.
>
> This is just an aside but are you aware of the '--hex-blob' argument to
> mysqldump? It causes binary data to be dumped as a hexadecimal string:
>
> http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option _mysqldump_hex-blob
>
> It's space-greedy (every byte in your original data requires two bytes in the
> dump file) but it seems like it would be compatible with your mysqldump/diff
> approach.
>
> Ben
>
No I wasn't aware of it.
I'll keep it in mind if I ever do start keeping binary blobs.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Displaying user data and picture
am 07.08.2009 08:38:57 von kranthi
not a good place to discuss the merits and demerits of binary blobs. is it ?
now coming back to the question. Firebug firefox addon, and http live
headers firefox addon will be of help to you in this case.
You have
tag(or something similar) i
suppose... try opening that src link in a new browser window. For the
application to work, you should see the picture of the user in the new
window
if there are any php errors in that file, correct them before you proceed.
if you see some arbitrary data(without any php warnings or notices)
but not the image that means you did not set header("Content-type:..')
in display_img.php
>> however with a .png extention to get the browser displaying the picture.
thats not required as long as you have correct Content-type header
Kranthi.
On Fri, Aug 7, 2009 at 05:38, Michael A. Peters wrote:
> Ben Dunlap wrote:
>>>
>>> I don't have any data blobs in my database - which makes incremental
>>> backups easier - I use rsync for files and do a nightly mysql dump.
>>> Except for the first of the month, the diff of that nights backup
>>> compared to first of month is saved to flat file for rsync. Binary blobs
>>> in the database would likely mean I have to change my backup protocol,
>>> but if it really is advantageous, I'd do it.
>>
>> This is just an aside but are you aware of the '--hex-blob' argument to
>> mysqldump? It causes binary data to be dumped as a hexadecimal string:
>>
>>
>> http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html#option _mysqldump_hex-blob
>>
>> It's space-greedy (every byte in your original data requires two bytes in
>> the
>> dump file) but it seems like it would be compatible with your
>> mysqldump/diff
>> approach.
>>
>> Ben
>>
>
> No I wasn't aware of it.
> I'll keep it in mind if I ever do start keeping binary blobs.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: Displaying user data and picture
am 07.08.2009 15:00:35 von Bob McConnell
From: Ralph Deffke
> however there are some reasonable reasons to store a
> image in the database.
> 1. if u have no access to write files to the disk this
> is the case in most free hosting services they give u
> php and mysql and thats it
> 2. if u want some access control to the image, e.g. login
> controlled. server admins dont like u playing arround
> with the htaccess file
> 3. its easy in those and other cases
> 4. image directores are public, and apear in search engines
5. There is a natural relationship between the images and other data
already in the database, such as ID photos linked to employee numbers.
Bob McConnell
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
RE: Displaying user data and picture
am 09.08.2009 13:48:28 von TedD
At 9:00 AM -0400 8/7/09, Bob McConnell wrote:
>From: Ralph Deffke
>
>> however there are some reasonable reasons to store a
>> image in the database.
>> 1. if u have no access to write files to the disk this
>> is the case in most free hosting services they give u
>> php and mysql and thats it
>> 2. if u want some access control to the image, e.g. login
>> controlled. server admins dont like u playing arround
>> with the htaccess file
>> 3. its easy in those and other cases
>> 4. image directores are public, and apear in search engines
>
>5. There is a natural relationship between the images and other data
>already in the database, such as ID photos linked to employee numbers.
6. When you move to another server, you simply move the database and
not the database AND image directories.
Cheers,
tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Displaying user data and picture
am 13.08.2009 04:07:48 von nashrul
>u want help? break down ur question to the point, none is going to downlod
>unknown zips searching for the spot.
the reason I put the files zipped is that when I put the code that include
html tags in the message, they are read as html tags by the browser and
displayed not as the code...
I don't know how to escape these html tags..
"nashrul" wrote in message
news:24839092.post@talk.nabble.com...
>
> I am new to php...
> I try to make a php page that displays form submitted data and image.
There
> are 3 php files,
> tampil_tamu_admin.php, edit_tamu.php and display_img.php.
> The user lists are displayed in the tampil_tamu_admin.php, and when the
user
> clicks one record, it shows edit page (edit_tamu.php) that display user
data
> and picture. (edit_tamu.php file includes img tag that calls
display_img.php
> with user id)
> The problem is the user data is displayed but the image is not
displayed...
> How can I display this image ?
>
> The codes are attached
>
> Thanks http://www.nabble.com/file/p24839092/guest-book.rar guest-book.rar
> http://www.nabble.com/file/p24839092/guest-book.zip guest-book.zip
> --
> View this message in context:
http://www.nabble.com/Displaying-user-data-and-picture-tp248 39092p24839092.html
> Sent from the PHP - General mailing list archive at Nabble.com.
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
View this message in context: http://www.nabble.com/Displaying-user-data-and-picture-tp248 39092p24943885.html
Sent from the PHP - General mailing list archive at Nabble.com.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php