Results 1 to 10 of 10
  1. #1
    Join Date
    Nov 2003
    Posts
    45

    Want to parse .png as .php

    I have a php image creation script for a signature image for battlefield vietnam stats from my website. The script has a .php ext, and being so there are quite a number of forum softwares out there that do not allow bb image code to a file thaa ends with a .php extension. I want to enable a mime type so that it parses .png files as php, and I'm trying to do that with a .htaccess file so that it parses a .png file as php and the file contains only the following line:

    Code:
    AddType application/x-httpd-php .png
    Yet I get a 500 ISE error when that .htaccess file is in there, and it's fine when I remove it, I think the mime type isn't in properly but information on doing something like this is scarse around the net, can anyone help me on why this is doing this?

  2. #2
    Join Date
    Nov 2003
    Posts
    45
    I just checked and put it in my mime.types and it works fine, just the .htaccess file doesn't, is there some configuration in apache that will make it so .htaccess won't work?

  3. #3
    Join Date
    Apr 2003
    Location
    London, UK
    Posts
    4,695
    I would use mod_rewrite to get round your problem, using something like:

    Code:
    RewriteRule ^images/(.*) images/$1.php
    So then to link to say image1.php in the bbcode you could just use:

    http://domain.com/images/image1


    Or even use ForceType application/x-httpd-php for the image directory, either should do the job.
    Last edited by Ash; 04-15-2004 at 05:35 AM.

  4. #4
    Join Date
    Nov 2003
    Posts
    45
    Will that do it for the whole site or just that directory, because I don't want the 30 or some pngs that on my site to be parsed every time just a directory.

  5. #5
    Join Date
    Nov 2003
    Posts
    45
    Or even use ForceType application/x-httpd-php for the image directory
    How do you do a mime type for a whole directory?

  6. #6
    Join Date
    Apr 2003
    Location
    London, UK
    Posts
    4,695
    Originally posted by Brad457
    Will that do it for the whole site or just that directory, because I don't want the 30 or some pngs that on my site to be parsed every time just a directory.
    mod_rewrite? i don't understand what you mean, if you call domain.com/images/image it would be the same as calling domain.com/images/image.php that's all.

    not sure why you're back to mime types again, but you could probally just add it at the directory level and it would apply to that directory and any below it.

  7. #7
    Join Date
    Nov 2003
    Posts
    45
    Ok I'll try mod rewrite thanks

  8. #8
    Join Date
    Nov 2003
    Posts
    45
    Ok this modrewrite thing puzzles me, can anyone help me write a rewrite statement for the following?


    http://domain.com/statssig/$x.png -> http://domain.com/statssig/sig.php?id=$x

    $x would be a number variable.

    Thanks for any help, it is much appreciated.

  9. #9
    Join Date
    Nov 2003
    Posts
    45
    Ok I think I figured out it why doesn't it work though ??!?

    Code:
    RewriteEngine on
    RewriteRule ^/statssig/(.*)\.png$ /sigimage.php?id=$1 [PT,L]

  10. #10
    Join Date
    Nov 2003
    Posts
    45
    Anyone know why this doesn't work?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •