PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Programmation & Conception > alt.comp.lang.php > creating image database
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
creating image database

Réponse
 
LinkBack Outils de la discussion
Vieux 24/06/2007, 00h16   #1 (permalink)
Kevin Raleigh
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut creating image database

I would like to create an image db so that I can store images and then
dynamically load
them into a slide show according to which file folder the image was stored
in.
Can anyone advise on what fields I might need to create in the mySQL db for
these
images? Suggestions on best practices? Pointers to examples of said scripts?

Thank You
Kevin


  Réponse avec citation
Vieux 24/06/2007, 10h44   #2 (permalink)
O. Schinkel
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: creating image database


"Kevin Raleigh" <kraleigh@sbcglobal.net> schrieb im Newsbeitrag
news:zNmdnYgIpI9WNeDbnZ2dnUVZ_hOdnZ2d@giganews.com ...
>I would like to create an image db so that I can store images and then
> dynamically load
> them into a slide show according to which file folder the image was stored
> in.
> Can anyone advise on what fields I might need to create in the mySQL db
> for
> these
> images? Suggestions on best practices? Pointers to examples of said
> scripts?

blob


>
> Thank You
> Kevin
>
>



  Réponse avec citation
Vieux 24/06/2007, 19h33   #3 (permalink)
Gufo Rosso
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: creating image database


"O. Schinkel" <xxxxx@yyyy.de> ha scritto nel messaggio
news:467e3cf8$0$14868$9b4e6d93@newsspool4.arcor-online.net...
>
> "Kevin Raleigh" <kraleigh@sbcglobal.net> schrieb im Newsbeitrag
> news:zNmdnYgIpI9WNeDbnZ2dnUVZ_hOdnZ2d@giganews.com ...
> >I would like to create an image db so that I can store images and then
> > dynamically load
> > them into a slide show according to which file folder the image was

stored
> > in.
> > Can anyone advise on what fields I might need to create in the mySQL db
> > for
> > these
> > images? Suggestions on best practices? Pointers to examples of said
> > scripts?

> blob
>


IMHO use db (size) 500 kb max


>
> >
> > Thank You
> > Kevin
> >
> >

>
>



  Réponse avec citation
Vieux 25/06/2007, 10h58   #4 (permalink)
Arjen
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: creating image database

Kevin Raleigh wrote:
> I would like to create an image db so that I can store images and then
> dynamically load
> them into a slide show according to which file folder the image was stored
> in.
> Can anyone advise on what fields I might need to create in the mySQL db for
> these
> images? Suggestions on best practices? Pointers to examples of said scripts?



Best practice: dont use a database to store images. Just store image
references and metadata.
id int(8), name varchar(20), alt varchar(255), folder varchar(20) should
do :-)

If you want to speed things up al little and make your query safer dont
use folder and image names but give them a number int(3), int(8) .. or
use the id. And put an index on the folder. If you descide to use
numbered folders try something like $myfolder = intval($_GET['folder']);

$sql = "SELECT * FROM IMAGES WHERE folder ='$myfolder'";

//

foreach ($images as $image)
{
echo '<img src="/path/to/img/'.$myfolder.'/'.$image['id'].'.jpg"
alt="'.$image['alt'].'" />';
}

--
Arjen
www.baby-namen.org (nog lang niet af)
  Réponse avec citation
Vieux 26/06/2007, 00h10   #5 (permalink)
Gufo Rosso
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: creating image database


"Arjen" <dont@mail.me> ha scritto nel messaggio
news:f5o3jj$5tp$1@brutus.eur.nl...
> Kevin Raleigh wrote:
> > I would like to create an image db so that I can store images and then
> > dynamically load


> > them into a slide show according to which file folder the image was

stored
> > in.
> > Can anyone advise on what fields I might need to create in the mySQL db

for
> > these
> > images? Suggestions on best practices? Pointers to examples of said

scripts?
>
>
> Best practice: dont use a database to store images. Just store image
> references and metadata.
> id int(8), name varchar(20), alt varchar(255), folder varchar(20) should
> do :-)


not 100 %
your photo in identify card, passport ,driver's license
photo is necessary ....... (500 kb is big resolution image in this case)


security access data


>
> If you want to speed things up al little and make your query safer dont
> use folder and image names but give them a number int(3), int(8) .. or
> use the id. And put an index on the folder. If you descide to use
> numbered folders try something like $myfolder = intval($_GET['folder']);
>


this solution is very good to other use
web
immage gallery (big photo)
video
flash .......
any file
..pdf



> $sql = "SELECT * FROM IMAGES WHERE folder ='$myfolder'";
>
> //
>
> foreach ($images as $image)
> {
> echo '<img src="/path/to/img/'.$myfolder.'/'.$image['id'].'.jpg"
> alt="'.$image['alt'].'" />';
> }
>
> --
> Arjen
> www.baby-namen.org (nog lang niet af)



  Réponse avec citation
Vieux 27/06/2007, 10h16   #6 (permalink)
Jussist
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: creating image database

> Best practice: dont use a database to store images. Just store image
> references and metadata.


This is not as simple as that - both approaches have their advantages,
which you can google easily. There are cases where both are better
approach - I usually store them to filesystem.

One point just came to my mind is a case where an application running
on a server needs to be moved to another server. In php-applications
the filesystem -stored files are usually easily found - but if one
expects that software installation and database transfer would have
the application (and content) fully running, this would not be the
case if files would be in filesystem, they would need to be
transferred separately. If the files would be stored to the database,
the db could be burned to cd/dvd, and imported - no need to seek for
the files according to their location. But this all of course depends.

Just some thoughts, on tea-daze.

--
Jussi
Deep abstraction kills strong typing.

http://disczero.com
http://naamio.net
http://hoffburger.com

  Réponse avec citation
Vieux 01/07/2007, 11h32   #7 (permalink)
Arjen
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: creating image database

Gufo Rosso wrote:
> "Arjen" <dont@mail.me> ha scritto nel messaggio
> news:f5o3jj$5tp$1@brutus.eur.nl...
>> Kevin Raleigh wrote:
>>> I would like to create an image db so that I can store images and then
>>> dynamically load

>
>>> them into a slide show according to which file folder the image was

> stored
>>> in.
>>> Can anyone advise on what fields I might need to create in the mySQL db

> for
>>> these
>>> images? Suggestions on best practices? Pointers to examples of said

> scripts?
>>
>> Best practice: dont use a database to store images. Just store image
>> references and metadata.
>> id int(8), name varchar(20), alt varchar(255), folder varchar(20) should
>> do :-)

>
> not 100 %
> your photo in identify card, passport ,driver's license
> photo is necessary ....... (500 kb is big resolution image in this case)
>
>
> security access data


Im not quite sure what you are saying here but you can just as easilly
secure an image with php as with mysql. Use readfile() and apache
redirect (img/(.+).jpg checkimg.php?img=$1)

checkimg.php
if($userhasacces($user))
{
readfile($img);
}
else
{
exit;
}

No need to bother mysql with this stuff :-)
  Réponse avec citation
Vieux 01/07/2007, 11h38   #8 (permalink)
Arjen
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: creating image database

Jussist wrote:
>> Best practice: dont use a database to store images. Just store image
>> references and metadata.

>
> This is not as simple as that - both approaches have their advantages,
> which you can google easily. There are cases where both are better
> approach - I usually store them to filesystem.


Nope it isn't that simple as that but it usually is best practive unless
you have a good reason not tot do it :-)

Arjen
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 11h29.


Édité par : vBulletin® version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,15340 seconds with 16 queries