PDA

View Full Version : php image background color


digital-cipher
01-09-2005, 10:36 AM
Hi all
can anyone show me how to set a image to centre of page and a black background in this php script
Im new to PHP :)

<?php

if(!isset($Id))
{
die("Need 'Id' parameter");
} else
{
$Id=addslashes($Id);
}

include("common.php");


//set up SQL connection
$link = mysql_connect ($server, $user, $password);
if (! $link)
{
die ("Couldn't connect to mySQL server");
}
if (!mysql_select_db ($db, $link) )
{
die ("Couldn't open $db: ".mysql_error() );
}


$query = "SELECT filetype, bin_data FROM tbl_Files WHERE id_files='$Id';";
$result = mysql_query($query);


$query_data = mysql_fetch_array($result);
$bin_data = $query_data[bin_data];
$filetype = $query_data[filetype];

Header("Content-type: $filetype");

print $bin_data;


?>



ive tryed echo "<body bgcolor=\"#ffffff\" text=\"#000000\">"
but still no good.

Sk8er9547
01-10-2005, 03:51 AM
Why not use CSS and then include that file in your PHP?

tsguitar2004
01-10-2005, 05:39 AM
There's nothing in that PHP script to set. There's no BODY content for any kind of page there. Is that ALL of the code you're working with?

I agree with the CSS solution. That's the best and recommended way to do it.
-ts

digital-cipher
01-10-2005, 01:49 PM
The other files im using are from openautoclassifieds car listing script.
the above file takes a image from a mqsql database and displays it.
the problem is the image opens in a new windows and has a white background.
the other files it uses is common.php (below)

<?php
//common include file

//mysql database setup
$user = "*****";
$password = "*****";
$db = "dcipher_db";
$server = "127.0.0.1";


//OPENREALTY ADMIN PASS AND LOGIN
//DEFAULTS TO MYSQL DATABASE USER/PASS
$openadmin = "*****";
$openpassword = "*****";



//SITE INFORMATION
//use city and state? 'Y' or 'N'
global $use_city_state;
$use_city_state = "N";



//used mostly for the email a friend function...
//but may come in handy elsewhere.
$baseurl = "http://pjmotors.freesuperhost.com";
$yourname = "PJ Motors";
$youremail = "Admin@it-systems.me.uk";

//number of listings to list at once:
$listings_per_page = 10;


//AGENT ADMINISTRATION
//use linefeed in description fields 'Y' or 'N'
$linefeeds = "Y";

//maximum number of imges for a given listing
$max_agent_images =1;

//how large can an agent image be? (n bytes)
$max_agent_upload = 1000000;


//INDIVIDUAL VEHICLE LISTING OPTIONS
//use email-a-friend option? 'Y' or 'N'
$friendmail = "N";

//maximum numer of images for one vehicle
$max_images = 6;

//max size of vehicle images (in bytes)
$max_prop_upload = 2000000;

//available options for vehicles
//each option separated by a ||
//currently supports up to 10 options
$vehiclefeatureoptions = "Climate control||Power Assisted Steering||ABS||Electric Mirrors||Electric Windows||Remote Central locking||Immobiliser";


//the master list of car makes
$carmakeslist = "Alfa Romeo||Audi||BMW||Bentley||Daewoo||Daihatsu||Daimler||Datsun||DeLorean||Ferrari||Fiat||Ford||Honda|| Hyundai||Isuzu||Jaguar||Jeep||Kia||Lamborghini||Lexus||Lotus||MG||Maserati||Mazda||Mercedes-Benz||Mitsubishi||Nissan||Porsche||Renault||Rolls Royce||Saab||Subaru||Suzuki||Toyota||Triumph||Vauxhall||Volkswagen||Volvo||Yugo||-----||Other";
?>