Welcome to TRiBot Forums

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

Sign in to follow this  
Followers 0
Encoded

How can I use a .php image when the file extension is blocked?

6 posts in this topic

So .php extensions are blocked for obvious reasons, is there any way I can change the image to .png and still have it dynamically update?

Share this post


Link to post
Share on other sites

I haven't really looked in to how this website is loading images.

Is it that you upload the image to the website or do you specify an URL to the image and then the forum fetches it everytime needed?

If the latter, you can make a php script which uses either file streams or use the file_get_contents() function and then makes a new .png (with the same name / same URL) with the latest info available that are stored in a database or a text file or wherever. Then you assign a cron to this script so it will be ran every 5-10 minutes or something.

 

If it is not the latter, I am not sure.

Share this post


Link to post
Share on other sites

To add to my previous post, instead of a cron you can make a call to the php script when you update wherever you save the xp gained in your script.

Share this post


Link to post
Share on other sites

This is from over 6 months ago. As you can tell from my signature I have figured it out.

 

I know it is from over 6 months ago, I can read and you do not need to clarify this for me.

However, this was one of the top post in the sub-forum and I saw no tutorial for this when I was looking briefly in the scripting tuts sub-forum.

You are not the only person that will ever aspire to create their own dynamic signature and your thread was already created.

Maybe in the future some newbie will find this post and be like "Oh snap! So that's how you do it!".

 

However, did you use the method I suggested?

1 person likes this

Share this post


Link to post
Share on other sites

May as well post the best solution to this... 
 
You need to create a .htaccess file in the root of your webserver (i.e. /var/www/html/). Note the "." at the start of the file name - Windows users will have to use an FTP client or similar to rename the file. Inside the file put:

RewriteEngine OnRewriteRule ^sig\.png sig.php

This means when example.com/sig.png is loaded, the server will request sig.php instead, so your PHP script should output the correct headers:

header('Content-Type: image/png');

You can also take this a step further and use regular expressions to match strings and patterns and can pass parameters to your PHP script:

RewriteEngine OnRewriteRule ^sig/(.+?)\.png sig.php?user=$1

This will make example.com/sig/VitaminD3.png load the script sig.php?user=VitaminD3

1 person likes this

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0

  • Recently Browsing   0 members

    No registered users viewing this page.