• Welcome to Simple Machines Community Forum. Please login or sign up.
December 03, 2021, 09:25:29 PM

News:

SMF 2.0.18 has been released! Please update. Read more.


Forum info image scripts

Started by Dragooon, June 05, 2008, 02:50:38 AM

Previous topic - Next topic

Dragooon

June 05, 2008, 02:50:38 AM Last Edit: June 05, 2008, 04:27:58 AM by Dragooon
I know some other are also available, but I created this just for the heck of it. I wanted to give a shot on the PHP image(GD) functions.

Currently there are : forum-stats and user-stats.
To implement you need to upload stats-bg.png and one of the files or all depending on what you need on your forum's root directory otherwise they will not work.

You MUST upload stats-bg.png otherwise it will not work. If you want to replace the background, replace the stats-bg.png file. No modifications to forum's files are required

userstats.php
This is called by http://yoursite.tld/userstats.php?u=x(Where x is the ID of the user), and if you want you can add ;show_avatar to show the avatar(Won't show if no avatar is there)
This is for showing a user's stats

forumstats.php
Simple link to the image and it will show the stats of the forum.

These can be used with img BBC tags or img HTML Tag.

Initially I made them in SMF 2 but they should also work with SMF 1.1 although I have not tested it with SMF 1.1

The background was obtained from DynamicDrive - Gradient Image Maker

I am planning on making more of these image scripts for different utilities

H

-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

TigerTails

This potentially looks like it would be a great mod. But when using it, I encounter errors. Userstats gives an SQL error, while Forumstats simply doesn't show an image at all..

"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '}topics
WHERE ID_MEMBER_STARTED = 2' at line 2
File: /*****************/userstats.php
Line: 65"

Dragooon

Hm I found the problem
Find
FROM {db_prefix}topics

WHERE ID_MEMBER_STARTED

And replace the {db_prefix} with {$db_prefix}

Dzonny

http://www.samo-opusteno.info/forum/userstats.php?u=1

It says "Imagge can not be displayed because it contains errors."
What is problem?

H

Dzonny, there are errors so it is giving an html page instead of an image, which is why it gives that message. The actual error is:


Warning: imagecreatefrompng(/home/samoo/public_html/forum/stats-bg.png) [function.imagecreatefrompng]: failed to open stream: No such file or directory in /home/samoo/public_html/forum/userstats.php on line 27

Warning: imagecolorallocate(): supplied argument is not a valid Image resource in /home/samoo/public_html/forum/userstats.php on line 31

Warning: imagecolorallocate(): supplied argument is not a valid Image resource in /home/samoo/public_html/forum/userstats.php on line 33

Warning: imagefill(): supplied argument is not a valid Image resource in /home/samoo/public_html/forum/userstats.php on line 37

Notice: SSI.php was unable to load a session! This may cause problems with logout and other functions - please make sure SSI.php is included before *anything* else in all your scripts! in /home/samoo/public_html/forum/SSI.php on line 172

Warning: Cannot modify header information - headers already sent by (output started at /home/samoo/public_html/forum/userstats.php:27) in /home/samoo/public_html/forum/Sources/Subs.php on line 3454

Warning: Cannot modify header information - headers already sent by (output started at /home/samoo/public_html/forum/userstats.php:27) in /home/samoo/public_html/forum/Sources/Subs.php on line 3455

Warning: Cannot modify header information - headers already sent by (output started at /home/samoo/public_html/forum/userstats.php:27) in /home/samoo/public_html/forum/Sources/Subs.php on line 3461

Warning: Cannot modify header information - headers already sent by (output started at /home/samoo/public_html/forum/userstats.php:27) in /home/samoo/public_html/forum/Sources/Subs.php on line 3464
-H
Former Support Team Lead
                              I recommend:
Namecheap (domains)
Fastmail (e-mail)
Linode (VPS)
                             

Dzonny

Hm, ok but i cant see it as image as well ?
What's problem?


Dzonny

oh, i found the problem PNG was upcase so i just rename it...
And one other thing
Line 126 and 127:
FROM {db_prefix}topics

WHERE ID_MEMBER_STARTED = $user[id] ".(!empty($modSettings['recycle_enable']) && $modSettings['recycle_board'] > 0 ?

There shoud also be  FROM {$db_prefix}topics

Now it's working, but i have "Total time loged in: 0 minutes." :/

Biology Forums

I can see this being very useful, though it never picked up. I tried it on my SMF 2.x forum - the forumstats.php worked but the userstats.php did not.

What could be the problem apart from those mentioned above?

habibkhan01

Many thanks TigerTails for your informative opinion that is very effective.

Advertisement: