473,394 Members | 1,738 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

PHP4 mime headers and CSS background-image

Hi all

I wrote a proxy script that fetches images out of a database and sends the
data to the browser, using the Content-type header. For instance, if I'm
loading a jpg image from the database, the script's output will be:

header("Content-type: image/jpeg");
header("Content-length: <filesize-goes-here>");
print $imagedata;

$imagedata then obviously contains the binary image data that was in a blob
field in the database.

All that works surprisingly swell when I call the script with something
like:

<img src='resource.php?name=thejpegfile.jpg'>

Now I have a need to use some of these database-archived images in CSS as
background images. For instance:

#menu {
background-image: url(./resource.php?name=thejpegfile.jpg);
}

However, that refuses to work, I'm left without the background image
although the rest of the page displays fine.

Any ideas why the db proxy script would work when called from HTML but not
when called from CSS?

Thanks,
:A
Apr 12 '06 #1
1 2075
NC
Littlefire wrote:

#menu {
background-image: url(./resource.php?name=thejpegfile.jpg);
}

However, that refuses to work, I'm left without the background image
although the rest of the page displays fine.

Any ideas why the db proxy script would work when called from
HTML but not when called from CSS?


It could be a file location issue; resource.php must be in the same
directory with the style sheet. Assuming this is not the case, you may
want to get rid of "./", replace a relative URL with an absolute URL,
and/or enclose the URL in quotes. Try these:

background-image: url("resource.php?name=thejpegfile.jpg");
background-image:
url("http://yoursite.com/resource.php?name=thejpegfile.jpg");

Cheers,
NC

Apr 12 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Alexander Schumann | last post by:
Hello everyone, We are building a new web based e-mail client "Fiezel" that will support IMAP, POP3 and SMTP protocols. Will be written in php4. I am trying to collect all the infomation on SNMP...
2
by: johnny | last post by:
hi all, I have a script to send newsletters both in html and text version, all works fine in email clients but unfortunately not in yahoo mail: it shows nothing in the body of the message,...
4
by: Alberto | last post by:
I am struggling with the php mail function so to allow a multipart mime settings where both the message and any set of attachments can be allowed. Teorically, I'd know how to do. I build up my...
3
by: Erik Rosenbach | last post by:
I have a question about how to parse out mime from a message. I have email messages that are stored in a database table and these messages have mime headers embedded within them. How can I parse...
2
by: bobkaku | last post by:
I added "MIME-Version: 1.0\r\nContent-Type:text/html; charset=iso-8859-1\r\n" as one of the parameters in the mail( ) function to replace the "Nobody" with a real From: email. That worked. ...
13
by: stam | last post by:
hello guys, i have met a problem that i can send the html e-mail by using MIME via php to yahoo mail and hotmail, but when i was try to send to gmail, it show all the html coding. can someone help...
3
by: b. dougherty | last post by:
Greetings all- I am trying to extract subject headers from emails that have been saved as text files. The subject headers are in MIME UTF-8 format, and so they appear like this: subject:...
4
by: ircmaxell | last post by:
I'm working on a php project modifying a CMS. I need to be able to view the headers that the script is sending at runtime. In php5, I can use headers_list(), but I'm using php4. Is there any way...
3
by: maheswaran | last post by:
Hi , Am new in PEAR. I have using PEAR/Mail.php for sending mails using smtp authentication. Here that my mailto form. <?php session_start(); ini_set("smtp_port",25); include("Mail.php");...
7
by: Ron Garret | last post by:
I'm writing a little HTTP server and need to parse request content that is mime-encoded. All the MIME routines in the Python standard library seem to have been subsumed into the email package,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.