News:

SMF 2.1.4 has been released! Take it for a spin! Read more.

Main Menu

Dynamic Banner

Started by EliteClicks, May 28, 2014, 02:21:27 PM

Previous topic - Next topic

Illori

you know by bumping daily you are pushing people that may help you further away? you are showing how impatient you are and people dont like to help impatient people.

EliteClicks

Quote from: Illori on June 06, 2014, 05:48:06 AM
you know by bumping daily you are pushing people that may help you further away? you are showing how impatient you are and people dont like to help impatient people.

ok mate :)

Will be patient.. :) ;)

EliteClicks


EliteClicks

any one here to help me?
:-X   :'(

margarett

Well, it seems you'll need to give it a bit of your attention, unfortunately.

This would be a good place to start having some tips:
http://stackoverflow.com/questions/901201/create-a-dynamic-png-image

Knowing that your php file needs to call SSI.php. If I find the time I might give it a try (as I have absolutely no idea how to do it right now :P )
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

EliteClicks

Quote from: margarett on June 19, 2014, 02:38:09 PM
Well, it seems you'll need to give it a bit of your attention, unfortunately.

This would be a good place to start having some tips:
http://stackoverflow.com/questions/901201/create-a-dynamic-png-image

Knowing that your php file needs to call SSI.php. If I find the time I might give it a try (as I have absolutely no idea how to do it right now :P )

That page is too confusing  :P
and I don't know PHP..  :-X as I'm only designer..
anybody here to help me :)

margarett

Well, here it is, at least what I was able to achieve...



I lowered the font to 14pt or it would get too big. I'm just compiling the information and BRB
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

margarett

So, this is the full code:
<?php

// Include the SSI file.
require(dirname(__FILE__) . '/../smf2/SSI.php');

$stats ssi_boardStats('array');
$who ssi_whosOnline('array');
//The information we require:
$total_members $stats['members'];
$total_posts $stats['posts'];
$total_topics $stats['topics'];
$total_online $who['total_users'];

// Path to our font file
$font './MyriadPro-Regular.ttf';

Header ("Content-type: image/jpeg");
$image imageCreateFromPNG("./banner.png");
$color1 ImageColorAllocate($image000);
$color2 ImageColorAllocate($image022130);
$color3 ImageColorAllocate($image20610);
$color4 ImageColorAllocate($image86089);

// Write stuff!
imagettftext($image14036015$color1$font$total_members);
imagettftext($image14036030$color2$font$total_posts);
imagettftext($image14036045$color3$font$total_topics);
imagettftext($image14036060$color4$font$total_online);

// Return output.
ImageJPEG($imageNULL93);
ImageDestroy($image);
?>



Notes:
* You should create a php file (I called this banner.php) and paste that code inside. This file must be placed somewhere in your server, as long as it has access to SSI.php
* In the same place, you need to put the base image named "banner.png" (or change the required name in the code above)
* In the same place, you need to put the font file
* You need to correctly define the path to SSI.php. The path above was for my local setup, you need to adjust to yours ;)
Then you can call your banner directly via URL. In a forum it needs to be inside "img" tags. Example in my test setup:
[img]http://localhost/banner/banner.php[/img]
* The text positions are fixed for this banner. If the dimensions change, they will be invalid. They can be easily changed in the code.

That's it :)
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

EliteClicks

#28
Works for me!!

and here is that..!!!!



works like charm!!

Just changed positions of text accordingly :)

margarett

:)

Marked as solved for you, let us know if you need further help
Se forem conduzir, não bebam. Se forem beber... CHAMEM-ME!!!! :D

QuoteOver 90% of all computer problems can be traced back to the interface between the keyboard and the chair

EliteClicks

Quote from: margarett on June 28, 2014, 01:47:44 PM
:)

Marked as solved for you, let us know if you need further help

ok thanks mate!

really helpful for me!  :)

Advertisement: