views:

27

answers:

1

I'm working on migrating a website from an external server (running Apache) to a local server (running IIS), and have come across an issue that I can't seem to resolve.

The site is using a custom Joomla plugin that grabs some graphics stored in a mysql database (for e.g. http://www.norfolktourism.ca/index.php?option=com_bdirectory&task=image&cid=191). However, when I migrate the site to the local server, the images are broken.

Upon further exploration, I've discovered that somehow, when ran on the local server, their seems to be whitespace (as in a new line) that gets processed before the header() function is processed, hence breaking the image (however, I don't get an error - just a broken image).

I'm absolutely baffled as to what the issue may be, as the code works fine on the external Apache server.

Would anyone have any suggestions on possible resolutions?

A: 

Difficult to say, and the scenario is not clear. The external Apache server runs on Linux or Windows ? May be some bug related with newlines?

Update: For example, for debugging, you could run this and compare with the output (for the same image) in your IIS server:

[root@server1 tmp]# wget -S -O imgunix.jpg 'http://www.norfolktourism.ca/index.php?option=com_bdirectory&task=image&cid=191'
HTTP request sent, awaiting response...
  HTTP/1.1 200 OK
  Date: Wed, 09 Jun 2010 15:18:21 GMT
  Server: Apache
  Content-Length: 4406
  Content-Disposition: filename="health.jpg"
  Content-Type: image/jpeg
Length: 4406 (4.3K) [image/jpeg]

[root@server1 tmp]# od -c imgunix.jpg | head                                                   0000000 377 330 377 340  \0 020   J   F   I   F  \0 001 002  \0  \0   d
0000020  \0   d  \0  \0 377 354  \0 021   D   u   c   k   y  \0 001  \0
0000040 004  \0  \0  \0   <  \0  \0 377 356  \0 016   A   d   o   b   e
0000060  \0   d 300  \0  \0  \0 001 377 333  \0 204  \0 006 004 004 004
leonbloy
Apache server is running on Linux...
MetalAdam
Well, it could be some relate problem then. First, you should check that the stored images in the DB are not corrupted. Then, that the code that shows it does not make some incorrect assumption with newlines.
leonbloy
The images are fine - we've taken a copy of the database from the working server, so there shouldn't be any sort of issues with that.I just can't figure out how the external server has a new line, and the local doesn't.I've explored the options of using ob_clean() and similar functions, but to no avail...
MetalAdam
can't you, for a given image, save the full response from the server (both in apache and in IIS), for example with `wget -S` and compare the first bytes ?
leonbloy