PHP Classes

File: geting.image.from.db.php

Recommend this page to a friend!
  Classes of Ahmed Shreef   Shref Image in DB   geting.image.from.db.php   Download  
File: geting.image.from.db.php
Role: Example script
Content type: text/plain
Description: example on geting img from db
Class: Shref Image in DB
Store and retrieve binary files in a MySQL table
Author: By
Last change:
Date: 19 years ago
Size: 744 bytes
 

Contents

Class file image Download
<?php

//this example uses class Shref_ImgInDb to get an image from data base
//and print it to the screen


// first we included the class in the file
require_once "Shref.ImgInDb.class.php" ;

//then created a new object
$Shref = new Shref_ImgInDb() ;


//**conected to the data base
// user : root
// pass :
// db name : test
$Shref->conDb("root","","test");

//**geting the image from the data base
//the table in data base that images are saved in : imageData
//the column where the images are saved in : image
//the column name of the primaryKey of that table : id
//the image id number in the table
$Shref->getImage("imageData", "image", "id",1);

//printing the image to the screen
$Shref->showImage();

?>