The image-data itself is stored in file_data, the image-Type in file_type.
The other fields contain additional information about the file - these fields are optional. There are a lot of tutorials and samples how to get images and other files uploaded and stored into a BLOB-field, so i will not describe this here.
2) getthumb.php file
You need to have gd-library installed!!!
You will need a php-file which will be used everytime you want to create a thumbnail.
This file is called with an url-argument named ID (see 3)).
<?php
// Place the code to connect your Database here
// DATABASE CONNECTION
global $id;
// Check if ID exists
if(!is_numeric($id)) die("No image with the ID: ".$id);
// Get data from database
$dbQuery = "SELECT file_data, file_type ";
$dbQuery .= "FROM tbl_files ";
$dbQuery .= "WHERE file_ID = $id ";
$dbQuery .= "LIMIT 1";
sandra vega wrote :1055
Hi,
your script was helpfull, but I still have a problem:
the thumbnail shows itself with the wrong set of colors. Any tip?
Thanks a lot!
Sorry for my english, too. Maybe you can talk spanish, so:
Tu código me resultó muy bueno, pero la imagen thumbnail que consigo aparece con una profundidad de color mucho menor a la de la imagen original (digamos, como si a una foto color la quisiera transformar en un gif de 8 colores o algo así)
¿tendrás idea de por qué?
Gracias!
Sandra
nebojsa tomcic wrote :1067
use function ImageCreateTrueColor() instead of ImageCreate()