Display Images from mySQL Binary Data

This tutorial will show you how to display your images (binary data) which has been saved in your mySQL database.
It’s very very simple.. so.. simple…. (read also: Storing Images/Binary Files to mySQL in PHP)

First of all we must connect to our database

PHP Code:
<?php
$username
= "";
$password = "";
$host = "localhost";
$database = "";

Read the rest of this entry »

Storing Images/Binary Files to mySQL in PHP

It is possible for us to store/save our images (binary files) into a mySQL database in PHP. In this article, we will discuss about “how to store images, audio, or another binary files into mySQL database with PHP script”. But, before we continue to the further step, you might want to consider some reason of why we should and why we shouldn’t store binary files in a database:

Reasons to store your images (binary files) in a database:

  1. Storing in a database allows better security for your files and images.
  2. Eliminates messy directory and file structures (this is especially true when users are allow to contribute files).
  3. Files/Images can be stored directly linking to user or advertiser information. Read the rest of this entry »

.htaccess Tricks: #1 – Definition

.htaccess Tips n Trick

.htaccess Tips n Trick

.htaccess definition:
Apache server software provides distributed (i.e., directory-level) configuration via Hypertext Access files. These .htaccess files enable the localized fine-tuning of Apache’s universal system-configuration directives, which are defined in Apache’s main configuration file. The localized .htaccess directives must operate from within a file named .htaccess. The user must have appropriate file permissions to access and/or edit the .htaccess file. Further, .htaccess file permissions should never allow world write access — a secure permissions setting is “644”, which allows universal read access and user-only write access. Finally, .htaccess rules apply to the parent directory and all subdirectories. Thus to apply configuration rules to an entire website, place the .htaccess file in the root directory of the site.
Read the rest of this entry »