tags:

views:

42

answers:

3

When moving a site from a staging environment to a production environment, .png image files are not being shown. When going to the image directly, firefox reports:

The image (image-path) cannot be displayed, because it contains errors.

I've checked mime.types in my apache config, and it contains a line for

image/png png

does anyone know what could be causing this? I've never encountered this before.

+1  A: 

If your image is a real one: maybe the image was broken during the FTP transfer (incomplete or bad/non binary transfer). Download it back from the server and have a look at it.

If your image is virtual or script generated: post the code, so we can have a look at it! This often happens with PHP if you have some chars before the <?php opening tag for example.

jdehaan
thank you you were correct.Filezilla was not in Auto, but rather in ASCII mode.
A: 

Could be a lot of things unfortunately:

  • Check the file permissions on the file, and ensure that apache can read them
  • Is this an 'actual' file, or is it coming from a DB or similar? If it's coming from a DB or Code investigate the actual string to be sure that content is being generated properly. If there are errors, they would ruin the output of the image
  • The file could actually be corrupt (try a re-upload)
Evan
A: 
  1. check .htaccess file url rewrite or any permission/restrictions etc.

  2. upload any png image and try to open it browser using direct path to ur png file. such as http://localhost/images/test.png (if it works fine, it means your apache process your png successfully fully)

  3. check if you have created any symbolic link your images directory in your previous server(host).

  4. check your directory permissions.

  5. clear your browser cache.

  6. check your appach virtual host file httd.conf in your preivous host. may be previous there has been created some alias or something like that. httpd.conf: ...

     <VirtualHost www.mydomain.com:80>
                 ServerAdmin [email protected]
                 DocumentRoot /home/www/www.mydomain.com/htdocs
                 ScriptAlias /cgi-bin/ /home/www/www.mydomain.com/cgi-bin/
                 ServerName www.mydomain.com
                 Alias /images/ /home/www/www.mydomain.com/images/
                 Alias /pictures/ /home/www/www.mydomain.com/upload/
                 Alias /errors/ /home/www/www.mydomain.com/errors/
                 Alias /catalog/ /home/www/www.mydomain.com/catalog/
                 ErrorLog /home/www/www.mydomain.com/logs/error_log
                 CustomLog /home/www/www.mydomain.com/logs/access_log
                 ScriptLog /home/www/www.mydomain.com/logs/script_log
                 ErrorDocument 403 /errors/403.html
                 ErrorDocument 404 /errors/404.html
                 ErrorDocument 500 /errors/500.html
         </VirtualHost>
    

let me know if any of this works or not

Ghost