RE: [PHP-DB] Images stored in a db - how to get them?

2004-01-26 Thread Ryan Jameson (USA)
 about once a quarter this question comes up and the answer is always
the same. Don't store them in the database, just store filenames and
store the files in the filesystem. That way you just generate a link and
treat it like any other image. Then when you query the database you
would create img tags with src property set to the image. You probably
don't want to store FULL path info, just enough to find the image.

 Ryan

-Original Message-
From: John T. Beresford [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 26, 2004 2:23 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Images stored in a db - how to get them?

Hello All,

I am interested in storing images in a table. My question is - What is
the proper way of retrieving the images and displaying them on a web
page?

Will I need to go through the GD library and create an image from the
information stored in the table?

While PHP is not new to me, images in db's is. Specifically, when info
is returned, it's usually in the form of:

$var=$row['FieldName'];

What would I then do with the 'BLOB' information? Is that where the GD
image tools come in play?


Any URL's or small hints to point in the right direction would be 
very much appreciated.

Thanks,
John
-- 
===
John T. Beresford
Apple Certified Technical Coordinator
http://www.deewi.com/
405.760.0794

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Images stored in a db - how to get them?

2004-01-26 Thread Paul Miller
While I totally agree with Ryan, there are instances where I have found
that people do not follow best practices, namely Oracle (Oracle File
Storage) and many MySQL/PHP programs out there (OPT and Help Center
Live).  So here is some code addressing both.

You would probably need an interpreter file.  Something like image.php
and call images like image.php?ID=house.

Then in your code, you grab the blob or file info and print it out after
you set the headers like this:

=
THE DB OPTION (local file system storage):
=
?php

$sql = select image_blob_column, mime_type
  from images 
 where image_ext_id = '$ID';

$results = sql_query($sql, $db_id);
if ($row_file = sql_fetch_array($results)){
// Set the headers
Header(Content-Type: .$row_file[mime_type]); // Gif or Jpeg
Header(Content-Disposition: inline); // Tells the browser to
display it 
   //   in the
browser if it is opened up by itself
Header(Content-Length:
.count($row_file[image_blob_column]));
echo $row_file[image_blob_column];
}

?
=
THE FILE OPTION (local file system storage):
=
?php

$sql = select file_path, mime_type
  from images 
 where image_ext_id = '$ID';

$results = sql_query($sql, $db_id);
if ($row_file = sql_fetch_array($results)){
// Set the headers
Header(Content-Type: .$row_file[mime_type]); // Gif or Jpeg
Header(Content-Disposition: inline); // Tells the browser to
display it 
   //   in the
browser if it is opened up by itself
Header(Content-Length: .filesize($row_file[file_path]));
$fp=fopen($row_file[file_path], rb);
fpassthru($fp);
}
?


The GD library is for creating new images using specified parameters or
editing an image.

HTH

- Paul

-Original Message-
From: Ryan Jameson (USA) [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 26, 2004 3:28 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Images stored in a db - how to get them?


 about once a quarter this question comes up and the answer is always
the same. Don't store them in the database, just store filenames and
store the files in the filesystem. That way you just generate a link and
treat it like any other image. Then when you query the database you
would create img tags with src property set to the image. You probably
don't want to store FULL path info, just enough to find the image.

 Ryan

-Original Message-
From: John T. Beresford [mailto:[EMAIL PROTECTED] 
Sent: Monday, January 26, 2004 2:23 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Images stored in a db - how to get them?

Hello All,

I am interested in storing images in a table. My question is - What is
the proper way of retrieving the images and displaying them on a web
page?

Will I need to go through the GD library and create an image from the
information stored in the table?

While PHP is not new to me, images in db's is. Specifically, when info
is returned, it's usually in the form of:

$var=$row['FieldName'];

What would I then do with the 'BLOB' information? Is that where the GD
image tools come in play?


Any URL's or small hints to point in the right direction would be 
very much appreciated.

Thanks,
John
-- 
===
John T. Beresford
Apple Certified Technical Coordinator
http://www.deewi.com/
405.760.0794

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DB] Images stored in a db - how to get them?

2004-01-26 Thread John T. Beresford
Thanks Ryan and Paul.

I agree, making references to the files is a more robust way of doing 
things. In fact, that's the way I normally work.

I'm in the process of learning more about 'BLOBS' and exploring the 
reality of storing images in a db/table versus the filesystem.

Anyway, thanks for the pointers. :)

John

At 3:44 PM -0600 on 1/26/04, Paul Miller wrote:
While I totally agree with Ryan, there are instances where I have found
that people do not follow best practices, namely Oracle (Oracle File
Storage) and many MySQL/PHP programs out there (OPT and Help Center
Live).  So here is some code addressing both.
You would probably need an interpreter file.  Something like image.php
and call images like image.php?ID=house.
Then in your code, you grab the blob or file info and print it out after
you set the headers like this:
=
THE DB OPTION (local file system storage):
=
?php
$sql = select image_blob_column, mime_type
  from images
 where image_ext_id = '$ID';
$results = sql_query($sql, $db_id);
if ($row_file = sql_fetch_array($results)){
// Set the headers
Header(Content-Type: .$row_file[mime_type]); // Gif or Jpeg
Header(Content-Disposition: inline); // Tells the browser to
display it
   //   in the
browser if it is opened up by itself
Header(Content-Length:
.count($row_file[image_blob_column]));
echo $row_file[image_blob_column];
}
?
=
THE FILE OPTION (local file system storage):
=
?php
$sql = select file_path, mime_type
  from images
 where image_ext_id = '$ID';
$results = sql_query($sql, $db_id);
if ($row_file = sql_fetch_array($results)){
// Set the headers
Header(Content-Type: .$row_file[mime_type]); // Gif or Jpeg
Header(Content-Disposition: inline); // Tells the browser to
display it
   //   in the
browser if it is opened up by itself
Header(Content-Length: .filesize($row_file[file_path]));
$fp=fopen($row_file[file_path], rb);
fpassthru($fp);
}
?
The GD library is for creating new images using specified parameters or
editing an image.
HTH

- Paul

-Original Message-
From: Ryan Jameson (USA) [mailto:[EMAIL PROTECTED]
Sent: Monday, January 26, 2004 3:28 PM
To: [EMAIL PROTECTED]
Subject: RE: [PHP-DB] Images stored in a db - how to get them?
 about once a quarter this question comes up and the answer is always
the same. Don't store them in the database, just store filenames and
store the files in the filesystem. That way you just generate a link and
treat it like any other image. Then when you query the database you
would create img tags with src property set to the image. You probably
don't want to store FULL path info, just enough to find the image.
 Ryan

-Original Message-
From: John T. Beresford [mailto:[EMAIL PROTECTED]
Sent: Monday, January 26, 2004 2:23 PM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Images stored in a db - how to get them?
Hello All,

I am interested in storing images in a table. My question is - What is
the proper way of retrieving the images and displaying them on a web
page?
Will I need to go through the GD library and create an image from the
information stored in the table?
While PHP is not new to me, images in db's is. Specifically, when info
is returned, it's usually in the form of:
$var=$row['FieldName'];

What would I then do with the 'BLOB' information? Is that where the GD
image tools come in play?
Any URL's or small hints to point in the right direction would be
very much appreciated.
Thanks,
John
--
--
===
John T. Beresford
Apple Certified Technical Coordinator
http://www.deewi.com/
405.760.0794
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DB] Images

2003-02-01 Thread John W. Holmes
 I try to create a simple image from some data from a database
(something
 like a checkerboard: if $a=1 then red, elseif $a=2 then blue etc).
 Everthing works fine until the assignment of colors. Whenever I use
the
 whole set of data that I have to display, wrong colors are assigned.
 Whenever I use small subsets of the whole set, then I have the correct
 display.  I only change the value of the limit from the query and the
 whole pattern might change drastically.

Show your code...

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] Images

2003-02-01 Thread Mihail Bota
John,

the code is listed below. Very cluttered, I acknoweledge:)
The limit you'll see in the second query is the maximal value for which I
get a good checkerboard.

Mihai

$q1=mysql_query(select distinct idsend from connections where publi=1 and
uid=1 order by idsend);
$nu1=mysql_num_rows($q1);
for ($i=0; $i$nu1; $i++) {
$qmax=mysql_fetch_row($q1);
$send[$i]=$qmax[0];
}
$q2=mysql_query(select distinct idrec from connections where publi=1 and
uid=1 order by idrec limit 127);
$nu2=mysql_num_rows($q2);
for ($i=0; $i$nu2; $i++) {
$qmax2=mysql_fetch_row($q2);
$rec[$i]=$qmax2[0];
}
$image=imageCreate(5000,5000);

for ($i=0; $i$nu1; $i++) {
for ($j=0; $j$nu2; $j++) {

$qcheck=mysql_query(select count(*) from connections where
idsend=$send[$i] and idrec=$rec[$j] and publi=1 and uid=1) or
die(mysql_error());
$rcheck=mysql_fetch_row($qcheck);
$check=0+$rcheck[0];
if ($check0) {
$rmax=mysql_query(select min(strength) from connections where
idsend=$send[$i] and idrec=$rec[$j] and publi=1 and uid=1)  or
die(mysql_error());
$qmax3=mysql_fetch_row($rmax);
$qq=$qmax3[0];
if ($qq==1) {
$a=0;
$b=0;
$c=0;
}
elseif ($qq==2) {
$a=255;
$b=50;
$c=50;
}
elseif ($qq==3) {
$a=200;
$b=100;
$c=100;
}
elseif ($qq==4) {
$a=0;
$b=0;
$c=255;
}
elseif ($qq==5) {
$a=0;
$b=255;
$c=255;
}
elseif ($qq==6) {
$a=0;
$b=255;
$c=200;
}
elseif ($qq==7) {
$a=0;
$b=100;
$c=255;
}

elseif ($qq==8) {
$a=0;
$b=100;
$c=255;
}
elseif ($qq==9) {
$a=255;
$b=0;
$c=0;
}
elseif ($qq==12) {
$a=0;
$b=0;
$c=255;
}
 elseif ($qq==0){
$a=200;
$b=200;
$c=200;
}
}
elseif ($check==0) {
$a=0;
$b=0;
$c=0;
}

$cul=imageColorAllocate($image, $a, $b, $c);;
imagerectangle($image, 7*$j,7*$i,7*$j+7,7*$i+7,$cul);
}
}

Header(Content-type: image/png);
imagePNG($image);
imageDestroy($image);

On Sat, 1 Feb 2003, John W. Holmes wrote:

  I try to create a simple image from some data from a database
 (something
  like a checkerboard: if $a=1 then red, elseif $a=2 then blue etc).
  Everthing works fine until the assignment of colors. Whenever I use
 the
  whole set of data that I have to display, wrong colors are assigned.
  Whenever I use small subsets of the whole set, then I have the correct
  display.  I only change the value of the limit from the query and the
  whole pattern might change drastically.

 Show your code...

 ---John W. Holmes...

 PHP Architect - A monthly magazine for PHP Professionals. Get your copy
 today. http://www.phparch.com/







-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] images

2002-10-21 Thread Jason Wong
On Monday 21 October 2002 22:33, Edward Peloke wrote:
 I am attempting to create a page on my website which will allow users to
 upload images.  I will need to rename and resize the image and then grab
 the location of the image and place it in the mysql db in a varchar field.

 I have been told there are already some code for this online that can be
 plugged into the php site.  Does anyone know of any?

1) Please don't hijack other people's threads. If you're posting a new topic, 
start a new thread! That is -- do not reply to an existing thread!

2) Try searching:

  www.zend.com
  www.hotscripts.com
  www.phpbuilder.com
  sourceforge.net
  freshmeat.net

-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *


/*
bank holiday - system operating credits  not recharged
*/


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] images

2002-10-15 Thread Hutchins, Richard

This has been asked many times before, but unless you have a really good
reason for storing the image in the database, don't. Instead, upload the
image file to a directory on the server and store the URL to the image in
the database. Fewer db resources are consumed.

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
 Sent: Tuesday, October 15, 2002 3:23 PM
 To: [EMAIL PROTECTED]
 Subject: [PHP-DB] images
 
 
 How can I allow the user to upload images to a php website 
 and have the
 image stored in the mysql db?
 
 Thanks,
 Eddie
 
 
 -- 
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] images

2002-10-15 Thread Jeffrey_N_Dyke


to upload use copy and the $_FILES array.  then around mysql, I tend to
store the path in mysql and the images on the server.  I personally don't
like to work with blobs and don't think it makes as much sense as they do
on the server.  the space they take up in the db seems like a waste.

my $.02...

jeff


|---|
|  Jeff | KeaneIT - Presidents  |
|  Landing | Suite: 200 |
|Outside: 617 -517-1772 |   |
|  E-mail: [EMAIL PROTECTED] |
|[ Mailing: 10 Presidents   |
| Landing  Medford, MA 02155 USA|
|   ]   |
|---|





   
 
epeloke@echoma 
 
n.com (EdwardTo: [EMAIL PROTECTED]
 
Peloke)  cc:   
 
 Subject: [PHP-DB] images  
 
10/15/2002 
 
03:23 PM   
 
   
 
   
 




How can I allow the user to upload images to a php website and have the
image stored in the mysql db?

Thanks,
Eddie


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] images

2002-10-15 Thread Edward Peloke

thanks Jeff and Richard, I will give that a shot.  Jeff, I see you aren't to
far from here if you work at Keane, I live in NH.

thanks again,
Eddie

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, October 15, 2002 2:59 PM
To: Edward Peloke
Cc: [EMAIL PROTECTED]
Subject: Re: [PHP-DB] images



to upload use copy and the $_FILES array.  then around mysql, I tend to
store the path in mysql and the images on the server.  I personally don't
like to work with blobs and don't think it makes as much sense as they do
on the server.  the space they take up in the db seems like a waste.

my $.02...

jeff


|---|
|  Jeff | KeaneIT - Presidents  |
|  Landing | Suite: 200 |
|Outside: 617 -517-1772 |   |
|  E-mail: [EMAIL PROTECTED] |
|[ Mailing: 10 Presidents   |
| Landing  Medford, MA 02155 USA|
|   ]   |
|---|






epeloke@echoma
n.com (EdwardTo: [EMAIL PROTECTED]
Peloke)  cc:
 Subject: [PHP-DB] images
10/15/2002
03:23 PM






How can I allow the user to upload images to a php website and have the
image stored in the mysql db?

Thanks,
Eddie


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] images

2002-10-15 Thread Hatem Ben

hello,

you can do it this way (using mysql):

?php
/*
create table images(
img_id int(4) NOT NULL auto_increment,
img_name varchar(60),
img_file_type varchar(10),
img_content blob,
PRIMARY KEY (img_id)
) TYPE=MyISAM;
*/
if (empty($imgfile) or $go!==uploadimg)
{
// Generate the form to upload the image
$form = form method=\post\ action=\\ enctype=\multipart/form-data\
Specify a name for your image : input type=\text\ name=\imgname\br/
Select your image file : input name=\imgfile\ type=\file\br/
input type=\submit\ value=\Submit\
input type=\hiddent\ name=\go\ value=\uploadimg\
/form;
echo $form;
} else {
// You have an image that you can insert it in database
/* Connecting, selecting database */
$link = @mysql_connect(mysql_host, mysql_user, mysql_password)
or die(Could not connect);
@mysql_select_db(my_database) or die(Could not select database);
// if the file uploaded ?
if (is_uploaded_file($imgfile))
{
// Open the uploaded file
$file = fopen($imgfile, r);
// you can get the $imgtype also here ;)
// Read in the uploaded file
$image = fread($file, filesize($imgfile));
// Escape special characters in the file
$image = AddSlashes($image);
}
else
$image = NULL;
$query = INSERT INTO images VALUES (NULL, '$imgname', '$imgtype',
'$image');
$result = mysql_query( $query ) or die(Query failed);
echo Hope this will help ;);
}
?


Regards,
Hatem

- Original Message -
From: Edward Peloke [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, October 15, 2002 9:23 PM
Subject: [PHP-DB] images


 How can I allow the user to upload images to a php website and have the
 image stored in the mysql db?

 Thanks,
 Eddie


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] images [Oops]

2002-10-15 Thread Hatem Ben

Oops sorry for never testing before sending :P the script works fine
but there is a little change, there is a hiddent should be changed to hidden
in the form ;)

that's all,
enjoy

- Original Message -
From: Hatem Ben [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Tuesday, October 15, 2002 9:46 PM
Subject: Re: [PHP-DB] images


 hello,

 you can do it this way (using mysql):

 ?php
 /*
 create table images(
 img_id int(4) NOT NULL auto_increment,
 img_name varchar(60),
 img_file_type varchar(10),
 img_content blob,
 PRIMARY KEY (img_id)
 ) TYPE=MyISAM;
 */
 if (empty($imgfile) or $go!==uploadimg)
 {
 // Generate the form to upload the image
 $form = form method=\post\ action=\\
enctype=\multipart/form-data\
 Specify a name for your image : input type=\text\
name=\imgname\br/
 Select your image file : input name=\imgfile\ type=\file\br/
 input type=\submit\ value=\Submit\
 input type=\hiddent\ name=\go\ value=\uploadimg\
 /form;
 echo $form;
 } else {
 // You have an image that you can insert it in database
 /* Connecting, selecting database */
 $link = @mysql_connect(mysql_host, mysql_user, mysql_password)
 or die(Could not connect);
 @mysql_select_db(my_database) or die(Could not select database);
 // if the file uploaded ?
 if (is_uploaded_file($imgfile))
 {
 // Open the uploaded file
 $file = fopen($imgfile, r);
 // you can get the $imgtype also here ;)
 // Read in the uploaded file
 $image = fread($file, filesize($imgfile));
 // Escape special characters in the file
 $image = AddSlashes($image);
 }
 else
 $image = NULL;
 $query = INSERT INTO images VALUES (NULL, '$imgname', '$imgtype',
 '$image');
 $result = mysql_query( $query ) or die(Query failed);
 echo Hope this will help ;);
 }
 ?


 Regards,
 Hatem

 - Original Message -
 From: Edward Peloke [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Sent: Tuesday, October 15, 2002 9:23 PM
 Subject: [PHP-DB] images


  How can I allow the user to upload images to a php website and have the
  image stored in the mysql db?
 
  Thanks,
  Eddie
 
 
  --
  PHP Database Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php


 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP-DB] Images and MySQL - please help

2002-04-17 Thread Ruprecht Helms

Hi DrTebi,

fetch the image from database A and put it into a buffer then

 I guess somehow I have to buffer the output, manipulate
 the buffer by adding the watermark, and then insert the image into the
 database B
  ^^

Regards,
Ruprecht


--
E-Mail: Ruprecht Helms [EMAIL PROTECTED]
Date: 17-Apr-02
Time: 10:41:33

to be informed - http://www.rheyn.de -

This message was sent by XFMail
--

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Images on MySQL

2002-03-29 Thread Cannis

In my experience storing images on disk is simpler, easier and not
messy.

I wouldn't think of storing binaries in a MySQL table...It just doesn't seem
right, but then again I have never tested this, only relied on my peers
telling me It's not right ;)

-Lasse

- Original Message -
From: Clever [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, March 28, 2002 12:35 PM
Subject: [PHP-DB] Images on MySQL


 Hi,
 I'm designing a site and I have to store a lot of images.
 Which is the best for speed?
 1) Store all images on a MySQL table?
 2) Save them on disk like normal files and only have pointers to them on
the
 database?
 Thanks a lot
 Clever Anjos



 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Images on MySQL

2002-03-29 Thread Jason Wong

On Thursday 28 March 2002 19:35, Clever wrote:
 Hi,
 I'm designing a site and I have to store a lot of images.
 Which is the best for speed?
 1) Store all images on a MySQL table?
 2) Save them on disk like normal files and only have pointers to them on
 the database?

2)


-- 
Jason Wong - Gremlins Associates - www.gremlins.com.hk

/*
The only difference in the game of love over the last few thousand years
is that they've changed trumps from clubs to diamonds.
-- The Indianapolis Star
*/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Images on MySQL

2002-03-29 Thread Steve Cayford

I keep hearing this from people (not to store images in mysql), but I 
would like to hear a bit more about why. Mysql has blob fields, so it 
seems perfectly reasonable to use them, doesn't it? I'm storing some 
images in a database and what's attractive to me about it is that I can 
put the images anywhere I like. I guess I could mount an image directory 
over NFS, but it seems easier and more consistent to use sql. Any 
thoughts on this?

-Steve

On Friday, March 29, 2002, at 05:43  AM, Jason Wong wrote:

 On Thursday 28 March 2002 19:35, Clever wrote:
 Hi,
 I'm designing a site and I have to store a lot of images.
 Which is the best for speed?
 1) Store all images on a MySQL table?
 2) Save them on disk like normal files and only have pointers to them 
 on
 the database?

 2)


 --
 Jason Wong - Gremlins Associates - www.gremlins.com.hk

 /*
 The only difference in the game of love over the last few thousand years
 is that they've changed trumps from clubs to diamonds.
   -- The Indianapolis Star
 */

 --
 PHP Database Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DB] Images from database

2001-07-10 Thread Benjamin Bleything

Check out http://www.phpbuilder.com/columns/florian19991014.php3.  It's a 
tutorial that explains getting images in and out of databases.  It also 
describes what this myscript.php thingy does.

Good luck,
Ben

Mailing-List: contact [EMAIL PROTECTED]; run by ezmlm
list-help: mailto:[EMAIL PROTECTED]
list-unsubscribe: mailto:[EMAIL PROTECTED]
list-post: mailto:[EMAIL PROTECTED]
Delivered-To: mailing list [EMAIL PROTECTED]
Date: Tue, 10 Jul 2001 13:41:27 -0600
From: Randall Barber [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
MIME-version: 1.0
X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
X-Priority: 3
X-MSMail-priority: Normal
Subject: [PHP-DB] Images from database

I have seen in several places the following line:

img src='myScript.php' etc..etc..

Will this tag work in both IE and Netscape?

What does myScript.php do?  Does it find an image and pass the binary data 
back?

Something like this--

?php

// Code to find get a path from a database

$fp = fopen(odbc_result($qryResult, imgPath), rb);
fpassthru($fp);
fclose($fp);
?

Am I getting this, or am I missing the whole point?
Thanks
RDB


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] images

2001-04-11 Thread Steve Brett

i'm pretty sure i read somewhere that is you use sessions php will not allow
an url that contains a path to a file typed in the address bar ...

may be wrong though ...

and apologies once again for the shopping cart debacle yesterday. some
poeple were complaining and rightly so. i received a dozen e-mails from the
two guys arguing at my works address, which was nice.



 -Original Message-
 From: Ron Brogden [mailto:[EMAIL PROTECTED]]
 Sent: 10 April 2001 19:57
 To: bryan; [EMAIL PROTECTED]; db
 Subject: Re: [PHP-DB] images
 
 
 At 11:48 AM 4/10/2001 -0800, bryan wrote:
 Maybe there is a way to use .htaccess more appropriately,
 but, this site allows guest / non-members, to buy something.
 Once they buy something, they are given a username of
 email, and password (they choose).  If they log back in, they
 should have access to ONLY the files they purchased.
 
 Easy enough.  Create a table that includes allowed download 
 file names 
 attached to a given user.  When the user logs in they are 
 given a list of 
 files they have permission to access.  The form does not send 
 the path but 
 the row *ID* of the entry from the SQL table.  When they choose the 
 appropriate link, the script looks it up in the database, 
 checks that the 
 user ID matches their authenticated one and if so uses 
 fread() to send out 
 the appropriate file.  Just include the appropriate MIME type 
 header and 
 that's that.
 
 The .htaccess file should just be used to enforce access 
 solely via the PHP 
 script (i.e. deny from all).
 
 Cheers,
 
 Ron
 
 --
 ---
 Island Net AMT Solutions Group Inc.  Telephone:   
250 383-0096
 1412 Quadra  Toll Free:   
  1 800 331-3055
 Victoria, B.C.   Fax: 
250 383-6698
 V8W 2L1  E-Mail:
 [EMAIL PROTECTED]
 Canada   WWW:   
http://www.islandnet.com/

-


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] images

2001-04-10 Thread Ron Brogden

At 11:48 AM 4/10/2001 -0800, bryan wrote:
Maybe there is a way to use .htaccess more appropriately,
but, this site allows guest / non-members, to buy something.
Once they buy something, they are given a username of
email, and password (they choose).  If they log back in, they
should have access to ONLY the files they purchased.

Easy enough.  Create a table that includes allowed download file names 
attached to a given user.  When the user logs in they are given a list of 
files they have permission to access.  The form does not send the path but 
the row *ID* of the entry from the SQL table.  When they choose the 
appropriate link, the script looks it up in the database, checks that the 
user ID matches their authenticated one and if so uses fread() to send out 
the appropriate file.  Just include the appropriate MIME type header and 
that's that.

The .htaccess file should just be used to enforce access solely via the PHP 
script (i.e. deny from all).

Cheers,

Ron

-
Island Net AMT Solutions Group Inc.  Telephone:  250 383-0096
1412 Quadra  Toll Free:1 800 331-3055
Victoria, B.C.   Fax:250 383-6698
V8W 2L1  E-Mail:[EMAIL PROTECTED]
Canada   WWW:   http://www.islandnet.com/
-


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP-DB] Images donot appear

2001-04-09 Thread Corin Rathbone

If you are using windows,
Uncomment (un ;) the following line in php.ini
extension=php_gd.dll

Regards,
Corin Rathbone
[EMAIL PROTECTED]

-Original Message-
From: Sharmad Naik [mailto:[EMAIL PROTECTED]]
Sent: 08 April 2001 18:44
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Images donot appear


Although i have compiled php with gd i don't get image do i have to make
any changes in php.ini

-Regards
--
The secret of the universe is @*!'^#+ NO CARRIER
___  _  _  _
|_|_||_||_||\/||_|| \
_|| || || \|  || ||_/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]