I'm making a php script that generates a dynamic PNG. The image itself is a countdown to the release of a new theme for UnSyntax Software.

The script itself works fine (although I still have to add the ACTUAL countdown timer) and the result is at http://www.unsyntax.alex10819.org/phpbb/Signature/TetraCounter.php

Code:
<?php
header("Content-type: image/png");
define('IN_PHPBB', true);
$site_root_path = '../';
$phpbb_root_path2 = '';
$phpbb_root_path = $site_root_path . $phpbb_root_path2;

$pic = imagecreatefrompng("Tetra.png");
$stat = imagecreatefromgif("track.gif");
$w = 15;
$h = imagesy($stat);
imagecopy($pic,$stat,215,20,0,0,$w,$h);

$m = date('m');
$d = date('d');
$M = 8-$m;
$D = 31-$d;

$white = imagecolorallocate($pic, 255, 255, 255);
$red = imagecolorallocate($pic, 255, 0, 0);
$green = imagecolorallocate($pic, 0, 255, 0);
imagestring($pic, 3, 190, 5, "ETA: ".$M." months ".$D." days", $white);
imagestring($pic, 3, 190, 20, $w."%", $green);

imagepng($pic);
imagedestroy($pic);
imagedestroy($stat);
?>


Problem is, I don't know how to get an actual .png to use in my forum signatures. Any help?
Just use a .htaccess redirect.
KermMartian wrote:
Just use a .htaccess redirect.

Um... how exactly do I do that? I googled it but I don't quite understand what to do.
one I have set up for a different site
htaccess wrote:
Yup, KJ, it's as easy as putting that line inside a .htaccess file in the same directory as your image.
well, obviously making the necessary changes to the line first.
Well... I tried that and this is my .htaccess (the filesmatch was there already):

Code:

Redirect /Signature/TetraCounter.png http://www.unsyntax.alex10819.org/phpbb/Signature/TetraCounter.php
<FilesMatch "^.*\.png">
   SetHandler application/x-httpd-php
</FilesMatch>


But I get a 404. The .htaccess is in /Signature/ so either I'm doing it wrong or it's because TetraCounter.png doesn't *technically* exist or both.

[edit]The two URLs are on the same line, it's just word-wrapped
That should work fine - for example, here's the .htaccess from http://www.cemetech.net/img:


Code:
Options All -Indexes
Redirect /img/about.png http://www.cemetech.net/img/misc/sig.php?6077
Redirect /img/sig.png http://www.cemetech.net/img/misc/sig.php
RewriteEngine On
RewriteRule ^sig/([0-9]+).png misc/sig.php?$1
RewriteRule ^sigs/forumsig/([0-9]+).png sigs/forumsig.php?uid=$1
RewriteRule ^sigs/daystodcs6.png dcs/dcs6/promo/daysto.php
Aha! I figured out what I was doing wrong:

Had to change:
Code:
Redirect /Signature/TetraCounter.png http://www.unsyntax.alex10819.org/phpbb/Signature/TetraCounter.php
to
Code:
Redirect /phpbb/Signature/TetraCounter.png http://www.unsyntax.alex10819.org/phpbb/Signature/TetraCounter.php

I guess my path wasn't specific enough. Laughing Thanks for the help Kerm and Rivereye. Smile
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement