Jump to content

Recommended Posts

Posted

Hi.. I'm a brand new user, and forgive me if I missed the obvious link, but where can I ask for support request? I want to see if I can setup one folder within my site to process .png files through PHP (for dynamically generated images containing script).

 

My account is under the Ads plan, and I only see very general topics here, or a forum for the Ads Unlimited plan.

 

Thanks in advance.

Posted

So, you want to have all PNG files processed by a script? You'll need to use a .htaccess file, utilizing PNG's MIME type to point all matching files to the aforementioned script. Please Google/Wikipedia this, as this information is common across the Apache webserver platform.

Posted

Thanks for the reply, djbob. I had tried that, but found that my .png files were prompted for download, rather than being rendered. My .htaccess file contains a single line of 'AddType application/x-httpd-php .png'.

 

I realise this isn't a PHP support group, but ifyou have any advise, it would be apreciated. I'm googling right now, also ;)

 

Many thanks

Posted

That line won't do you any good, as you're just telling PHP to try processing that file. It'll find no "<?php" marks, so it's pass it on in its raw form as an HTML page and your computer won't see any HTML headers so will just try downloading it.

 

I'm really not sure about what you need to do. But either way, what exactly are you trying to do? It seems to me an easier way of getting the URL's to match would be to use mod_rewrite to point all .png files in the folder you specified to a PHP file with the PNG file in the query string.

Posted

Thanks a million, djbob. While I didn't understand the 'mod_rewrite', I was able to googl it and find something that works. Basically my .htaccess file now looks like this:

 

AddType application/x-httpd-php .png
RewriteEngine On 
RewriteRule .png /phpsigs/test.php

 

This allows ANY .png file to redirect to test.php, and that script renders the .png file correctly. Plus, with a little bit of trickery, I was even able to capture the image name, and use that inside the image.

 

e.g. http://beekay.heliohost.org/phpsigs/djbob.png will show a (very temporary) image withsome stuff and your name on it. There is no physical file called djbob.png, and changing the name to 'whowouldhavethoughtitwouldwork.png' will work too!

 

Thanks for all the help and nudges in the right direction.

 

 

Posted

No problem, but I getting a bunch of gibberish (raw PNG content is my guess) when I click your link. I'm guessing that the error are messing it up - you might want to set up error handlers.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...