Re: [PHP] Displaying user data and picture

2009-08-12 Thread 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 anas_a...@yahoo.com wrote in message
news:24839092.p...@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-tp24839092p24839092.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-tp24839092p24943885.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: [PHP] Displaying user data and picture

2009-08-09 Thread 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: [PHP] Displaying user data and picture

2009-08-07 Thread 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 img src=display_img.php?id=1 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. Petersmpet...@mac.com 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: [PHP] Displaying user data and picture

2009-08-07 Thread 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: [PHP] Displaying user data and picture

2009-08-06 Thread 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_def...@yahoo.de


nashrul anas_a...@yahoo.com wrote in message
news:24839092.p...@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-tp24839092p24839092.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: [PHP] Displaying user data and picture

2009-08-06 Thread 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 Deffkeralph_def...@yahoo.de 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_def...@yahoo.de


 nashrul anas_a...@yahoo.com wrote in message
 news:24839092.p...@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-tp24839092p24839092.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: [PHP] Displaying user data and picture

2009-08-06 Thread Michael A. 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



Re: [PHP] Displaying user data and picture

2009-08-06 Thread Andrew Ballard
On Thu, Aug 6, 2009 at 5:02 PM, Michael A. Petersmpet...@mac.com 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.


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: [PHP] Displaying user data and picture

2009-08-06 Thread 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: [PHP] Displaying user data and picture

2009-08-06 Thread Michael A. 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