Como desplegar las imágenes asociadas a los registros de una base de datos

From ABCD Wiki
Jump to: navigation, search

Respuesta enviada por Egbert de Smet:

the obvious answer is another question : where are your pictures stored ?

There are two options here :

- either you store in /ABCD/www/htdocs/bases/[yourdb], so this is the 'DocumentRoot' (of Apache) followed by the 'bases' folder and in there the subfolder named with your database-name
-or you define in the main database-folder for your database (e.g./ABCD/www/bases/[yourdb]) a file named 'dr_path.def' (for 'digital repository path definition') in which you put the path where you want your 'repository' to be, which then can also be outside the DocumentRoot, e.g. your bases-folder itself.

You will see an example of this for the CEPAL (biblo) demo-database.

Let me explain how in the patrons (users) database the picture is shown, without the use of the 'show_image.php' script as an alternative :

I created an 'Alias' in Apache virtual host configuration for ABCD(actually by copying/editing the example of ScriptAlias in the existing configuration httpd-vhosts-abcd.conf) : Alias /docs/ "/ABCD/www/bases/"
        <Directory "/ABCD/www/bases/">
           AllowOverride None
           Options None
           Order allow,deny
           Allow from all
       </Directory>
After restarting Apache, now it will substitute all occurrences of '/docs/' in the URL by the full path as defined: /ABCD/www/bases/.
So in the PFT now you only have to refer to the pictures by putting '/docs/' followed by the database-name (users) and then the repository subfolder-name, followed finally by the actual name of the picture (which is taken from v620
Thus the PFT becomes :
     '<img src="/docs/users/dr/'v620'"</img>'

where the path for the image will actually be /ABCD/www/bases/users/dr/. NSo you have to put the pictures there. It is outside the Apache DocumentRoot (or domain), but by creating the Alias it can still work (as that is the purpose of Aliases).

I hope this clarifies things and allows you to solve the problem.

Egbert de Smet

Universiteit Antwerpen