Jump to content

Masking extensions


AJay17

Recommended Posts

I've created a script that dynamically generates an image. It is a php file that can be called inside of an image tag. The site that it will be used on mainly does not display images with php extensions. Is there any way I could give it a jpg extension and my server still process it as jpg?

 

See the image below as an example. The site is somehow setup to where the image will change dynamically based on what the filename is. I really need to do it this way, any ideas?

 

http://card.mygamercard.net/AJay18.png

Link to comment
Share on other sites

yes, but it has nothing to do with php.

 

You use modurl/ urlrewirtes, and basicalyl you make a pseduo folder so when someone goes to

http://www.mysite.com/images/5.jpg

 

the apache will actually execute the script at

http://www.mysite.com/scripts/dynamic_image.php?id=5

 

make sense?  it takes a bit of work to do, and this isn't the location to has it answered, but that is the idea behind it.  So the user actually lands on what they think is a .jpg page, but actually it executes a different page.

Link to comment
Share on other sites

Another way to do it is to set up apache to parse .jpg files as .php files. If you were to stick the following code in a .htaccess file in a sub-directory:

 

AddType application/x-httpd-php .jpg

 

Apache would parse your .jpg files in that folder as php files. Thats why i say put it in a sub-folder, otherwise none of your normal jpg images would work!

 

It's how i got the picture in my signiture to work.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.