SigGen URL's

A signature and avatar generator addon

Moderator: zanix

SigGen URL's

Postby Wisblade » Fri Nov 02, 2007 10:43 am

SigGen : 0.3.0 b3.
Latest WoWRoster 2.0 (updated 01/11/2007).

Hi.

The question seems to be quite obvious, but RegExp and me aren't friends at all... After trying to solve it myself during 2 hours, I surrender.

My realm have a space in its name ("Khaz Modan")... And this is not well appreciated by the PHPBB2 "IMG" BBCode. Also, it doesn't like at all to have special characters like "@", ".php" and others pleasant jokes.

So, I decided to save all signatures / avatars into a folder. But :
1) SigGen doen't show the saved location of the image on character profiles.
2) All given URLs contains a space inside them

Since I do not have more than one guild on this roster (and doesn't want to have more than one), I tried to have this :
http ://guildhost/sig/CharacterName.png to be transformed, internally, in either the full, normal URL (with "index.php" inside), or to the saved signature folder with adding "@EU-Khaz%20Modan" after.

Nothing works, excepted an ugly hard-coded link to the signature folder, with a manual %20 inserted.

I wished to have an option to remove realm name from signatures / avatars names... And / or that realm names never have a space inside them (removed by SigGen for URLs).

At this point, with a phpBB 2.0 forum and the current SigGen, it's (nearly) impossible to get signatures and/or avatars. "Normal" URLs given by SigGen are rejected, signatures shows up only with manual trick.
And I can't tell guildmates to understand why spaces are forbidden...

Any solution, please ?

Thanks in advance.
Wisblade
WR.net Apprentice
WR.net Apprentice
 
Posts: 4
Joined: Wed Oct 17, 2007 4:36 am

SigGen URL's

Postby zanix » Fri Nov 02, 2007 1:07 pm

The ability to change the url on the character page was suggested in another post and I will get something like that soonish
Probably a switch to show the script location or the saved image location

I didn't think about the @ in the image name not working in phpbb
(is there any other symbols that are not allowed)
Do you know of any other characters that can work as a delimiter?

The url also isn't url encoded because I've been having problems with the url that is generated not working
I think I'll need to split the url up and encode each piece, then put it back together

I can add some code to pick the default realm when it isn't specified
Only the save code will still generate Name@RC-Realm.png when it saves the image, just to warn ya
Read the Forum Rules, the WiKi, and Search before posting!
WoWRoster v2.1 - SigGen v0.3.3.523 - WoWRosterDF
User avatar
zanix
Admin
Admin
WoWRoster.net Dev Team
WoWRoster.net Dev Team
UA/UU Developer
UA/UU Developer
 
Posts: 5543
Joined: Mon Jul 03, 2006 8:29 am
Location: Idaho Falls, Idaho
Realm: Doomhammer (PvE) - US

SigGen URL's

Postby tuigii » Fri Nov 02, 2007 6:19 pm

Wisblade,

First of all, me too, I'm running around on Khaz Modan....
Nice server, pubs with flexible opening hours - and we tracked down nearly every Kevin to make him type /world-quit

Also using and admining phpBB (2.0.22) and know what you mean.

I have a trick for you :wink:

My signature on one of those forums :
Code: Select all
<img src="http://www.papy-team.fr/roster/index.php?p=util-siggen&mode=signature&member=Nowwhat@EU-Khaz Modan">


My roster directory is in /roster/

For this, I had to 'allow' the HTML code 'img' on the configuration page.

Ok, you say : "What ?? "
Your Guildies have to surround the URL with quotes like "... "
Putting this : <img src= in front if it, and putting a > after it.

True, this is nearly as difficult as installing WoW, opening an account with Blizzard and the lot.... (ok, I'm just joking...)

But it works well.

Btw : phpBB 3 (in RC7 phase now) will take care of this issue - very soon.

URL rewriting should work for you, because it handles these matters quit well:

My .htaccess in my web root:
Code: Select all
SetEnv REGISTER_GLOBALS 0
SetEnv ZEND_OPTIMIZER 1
SetEnv MAGIC_QUOTES 1
SetEnv PHP_VER 5
RewriteEngine on
RewriteBase /
RewriteRule ^/?roster/(sig|av)/(.*)\.png$ ./roster/index.php?p=util-siggen-$1&member=$2


My rsoter root folder is directly in my main web root, like http://www.papy-team.fr/roster/....

Example (try this code as your signature on a phpbb site)
Code: Select all
[img]http://www.papy-team.fr/roster/sig/Nowwhat.png[/img]

=
Image

This means that all the secret is in the (your) .htaccess file.
Be carefull with the syntax, because I'm not saying that mine will do the job for yours, and your server should support mod_rewriting also. Webservers are like cars, the do globally all the same thing, but there are details ^^
Last edited by tuigii on Fri Nov 02, 2007 8:14 pm, edited 3 times in total.
User avatar
tuigii
WR.net Master
WR.net Master
 
Posts: 891
Joined: Wed Dec 27, 2006 12:57 pm
Location: Somewhere in the South Ouest of France

Re: SigGen URL's

Postby Wisblade » Sat Nov 03, 2007 8:48 pm

Thanks for you replies, but it does not solve my problem... SigGen shows an unusable URL for the forum, that's the core of the problem.

I agree with you, tuigii : enabling HTML may solve this problem. But it's a not very clean, users have habits... And BBCode is one of theses habits.

For the .htaccess rules, don't ask me why, but I never managed to use regexp without problems. I can follow a multi-CPU / multiprocess / multithreaded application without taking notes, but I surrender with regexp. Nobody can know everything, I think...
I wished to have this scheme :
Code: Select all
http://stravaganza.guild-heberg.fr/sig/Wisblade.png

transformed to
Code: Select all
http://stravaganza.guild-heberg.fr/images/sig/Wisblade@EU-Khaz%20Modan.png

or to the full script URL (if this don't break the img BBcode tag).
With the rules you gave me, I only managed to have the "SigGen works" test image, nothing else (at least, I proves me that the server supports the mod_rewriting !)

zanix wrote:Do you know of any other characters that can work as a delimiter?
Here are all regexp used for the IMG tag (removed from context) :
Code: Select all
$bbcode_tpl['img'] = str_replace('{URL}', '\\1', $bbcode_tpl['img']);

$patterns[] = "#\[img:$uid\]([^?](?:[^\[]+|\[(?!url))*?)\[/img:$uid\]#i";
$replacements[] = $bbcode_tpl['img'];

$text = preg_replace("#\[img\]((http|ftp|https|ftps)://)([^ \?&=\#"\n\r\t<]*?(\.(jpg|jpeg|gif|png)))\[/img\]#sie", "'[img:$uid]\\1' . str_replace(' ', '%20', '\\3') . '[/img:$uid]'", $text);
As I said, regexp and I are not friends...

zanix wrote:The url also isn't url encoded because I've been having problems with the url that is generated not working
I think I'll need to split the url up and encode each piece, then put it back together
In fact, only the image name have to be URLencoded, after the UTF-8 conversion of course... The rest of the image URL is already useable, at least if the admin doesn't use spaces in the save paths.

zanix wrote:I can add some code to pick the default realm when it isn't specified
Only the save code will still generate Name@RC-Realm.png when it saves the image, just to warn ya
In fact, as long as the user can cut/paste the URLs given by SigGen, I'll be happy. Even if the URL is a cryptic code !! ;-)
Some suggestions :
- Allow the admin to add a prefix / postfix to the URL (like BBcode / HTML opening & closing tags), in order to have a "no more operation" copy/paste.
- Have two choices : "complex" URL that calls the script (when the server / forum supports it), or the "static" URL (shortened, links directly to the saved image, URLencoded). The admin choose which one is displayed, according to the server possibilities.

I think that these two options will solve any problem that could be encountered with SigGen links.


Regards.
Wisblade
WR.net Apprentice
WR.net Apprentice
 
Posts: 4
Joined: Wed Oct 17, 2007 4:36 am

SigGen URL's

Postby PleegWat » Sat Nov 03, 2007 9:04 pm

As a different approach to the problem, I don't think blizzard uses _ in their realm names, and I wouldn't expect them to. Maybe those are a suitable replacement to spaces?
I <3 /bin/bash
User avatar
PleegWat
WoWRoster.net Dev Team
WoWRoster.net Dev Team
 
Posts: 1636
Joined: Tue Jul 04, 2006 1:43 pm

SigGen URL's

Postby tuigii » Sat Nov 03, 2007 11:26 pm

Hummm.

From what I read, you shouldn't touch nothing in phpbb.
I'm not doing so neither, and the only URL it sees is something like this :
Code: Select all
[img]http://www.papy-team.fr/roster/sig/Nowwhat.png[/img]


You said that siggen replied with a generic image : that is good news.
Because, when I was shapping this line:
Code: Select all
RewriteRule ^/?roster/(sig|av)/(.*)\.png$ ./roster/index.php?p=util-siggen-$1&member=$2
I saw that image many times :wink:

Siggen only need the name, without the "@EU-Khaz Modan" part - anyway, this part breaks the phpBB img tag parsing (your preg friend).

Open siggen, goto line 73 and insert a simple echo $name;
This breaks image generation, but show you if the named is being captured.

Note that siggen uses many more params, I left out the &saveonly=0 part, you can put it back in like this:
Code: Select all
RewriteRule ^/?roster/(sig|av)/(.*)\.png$ ./roster/index.php?p=util-siggen-$1&saveonly=0&member=$2


Check that I use a no-dafault solution:
Look at : http://www.wowroster.net/MediaWiki/SigGen
For another method, you can use mod_rewrite to re-write the path to the generator files

To use the this method, you must have an Apache server with mod_rewrite turned on

.htaccess file (for Apache)
(Placed in the roster/ folder)

RewriteEngine on
RewriteRule ^(sig|av)/(.*).png$ ./addons/siggen/$1.php?member=$2

See the difference: the opening ^ has to be for me a ^/?
(and the fact that I didn't use the .htaccess file in the roster folder).

Please note the my .htaccess file is in the root of my server, I don't use (disabled) the one in /roster folder.

An altenatif: signature mode only:
Code: Select all
RewriteRule ^/?roster/sig/(.*).png$ ./roster/index.php?p=util-siggen&mode=signature&saveonly=0&member=$1

Note that p= became a simple util-siggen
And I have just a member=$1 right now.

Why am I staying concentrated on this CEO busines ?
Because, if it works for you, a simple hack in siggen, the part that show the links for a signature and a avatar, is being made very easy.
No need to change the way file name are being generated and stored (the /sig/nam@XXRealm.ext)
Not printing the links using the @XXRealm.ext is easy for you, without you being waiting for Xanix diving into siggen, adding other stuff without breaking actual stuff. And the links can be used in the img bbcode right away.

Or, go for phpBB RC7 - I'll be doing so for a live forum in a week or so => www.les-potes-ages.fr - I use this SEO stuff over there already on this 2.0.22 forum.

Use this forum www.les-potes-ages.fr/phpBB3 (my test RC7 forum, don't tell anyone :wink: ) and create an account.
I can use this as a signature without any hassle
Code: Select all
[img]http://www.papy-team.fr/roster/addons/siggen/sig/Nowwhat@EU-Khaz Modan.png[/img]

This one takes the pre-stored file name in the sig directory - it works great.
Last edited by tuigii on Sat Nov 03, 2007 11:53 pm, edited 2 times in total.
User avatar
tuigii
WR.net Master
WR.net Master
 
Posts: 891
Joined: Wed Dec 27, 2006 12:57 pm
Location: Somewhere in the South Ouest of France

SigGen URL's

Postby PleegWat » Sun Nov 04, 2007 1:00 am

Instead of an echo, use the debugMode($line, $message, $file=null, $config=null, $message2=null) function to aid in siggen debugging. It draws an image containing the specified text.
I <3 /bin/bash
User avatar
PleegWat
WoWRoster.net Dev Team
WoWRoster.net Dev Team
 
Posts: 1636
Joined: Tue Jul 04, 2006 1:43 pm

Re: SigGen URL's

Postby tuigii » Sun Nov 04, 2007 3:03 am

Thanks Pleegwat !

Code: Select all
debugMode('Params'," name = ".$name." sig_saveonly = ".$sig_saveonly." mode = ".$config_name." saveonly = ".$sig_saveonly." etag_override = ".$etag_override." format = ".$img_format,(__FILE__),0,'');


on line 150 in siggen.php will do fine.
User avatar
tuigii
WR.net Master
WR.net Master
 
Posts: 891
Joined: Wed Dec 27, 2006 12:57 pm
Location: Somewhere in the South Ouest of France

Re: SigGen URL's

Postby Wisblade » Sun Nov 04, 2007 8:46 pm

Thanks for your answers, I'll test it very shortly.

Now, I have another problem, always "linked" to the URL problem : SigGen doesn't take care of the accent conversion.

For example, this player : Téthanös have a filename on the server with UTF-8 inside (Téthanös@EU-Khaz Modan.png).
With accent conversions, I don't get "Tethanos@EU-Khaz Modan.png as expected, but TA©thanA¶s@EU-Khaz Modan.png. Note that the accent conversion have worked, but on the UTF-8 characters and not on the "real" character (é became A©).

What should I add to the removeAccents function to have it work as expected ? Does PHP have a native UTF-8 -> ASCII conversion function that can be inserted before the character replacement ?
Wisblade
WR.net Apprentice
WR.net Apprentice
 
Posts: 4
Joined: Wed Oct 17, 2007 4:36 am

SigGen URL's

Postby zanix » Mon Nov 05, 2007 3:01 am

In function replaceAccents, replace
Code: Select all
ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ


With
Code: Select all
ÀÁÂÃÄÅà áâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ



As for the url stuff, i haven't had time to even look at it yet
Read the Forum Rules, the WiKi, and Search before posting!
WoWRoster v2.1 - SigGen v0.3.3.523 - WoWRosterDF
User avatar
zanix
Admin
Admin
WoWRoster.net Dev Team
WoWRoster.net Dev Team
UA/UU Developer
UA/UU Developer
 
Posts: 5543
Joined: Mon Jul 03, 2006 8:29 am
Location: Idaho Falls, Idaho
Realm: Doomhammer (PvE) - US

Re: SigGen URL's

Postby tuigii » Mon Nov 05, 2007 6:16 am

When you see these filenames in the /sig folder, what do you use too see them ? I mean, I use a FTP program (SmartFTP) and I saw ones that I couldn't delete accented filenames. Member-signature files are a good example here. Many of them are accented.
So, I found out that I had to switch my FTP to UFT-8 also, and all went fine afterwards.

Example : we have a player named Circé.

I do not use "Convert accents' because .... I do not need it !
This link:
Code: Select all
http://www.papy-team.fr/roster/sig/Circé.png

works just fine, just copy the link in your browser adress bar to see it.
(btw: CEO works here also ;-) )
[edit: thats 1-0 for IE7 - Firefox shows the generic image ?? Is this also a local setting ?? - the URL becomes .../Circ%E9.png ]
Just one note: open your siggen.php file, and save it back on the server as a UFT-8 file (normally, it, but messing with it can change it's format).
I say this because when I read your post, I took an URL of an accented lettre-member name to check : bingo, I got the generic SigGen image like you. I opened siggen.php for editing (using UltraEdit here) and saw that it was a in DOS format. A convert to UTF-8 and a save back - and all was well.
When I write it back as a DOS ASCI PHP file, it will nagle the accented lettre in to a é or something like that. And, ofcourse, the member file Ciré@EU-Khaz Modan.png does not exists, a generic image will be shown.
User avatar
tuigii
WR.net Master
WR.net Master
 
Posts: 891
Joined: Wed Dec 27, 2006 12:57 pm
Location: Somewhere in the South Ouest of France

SigGen URL's

Postby zanix » Thu Nov 29, 2007 2:55 pm

Fixed in v0.3.0.320
Read the Forum Rules, the WiKi, and Search before posting!
WoWRoster v2.1 - SigGen v0.3.3.523 - WoWRosterDF
User avatar
zanix
Admin
Admin
WoWRoster.net Dev Team
WoWRoster.net Dev Team
UA/UU Developer
UA/UU Developer
 
Posts: 5543
Joined: Mon Jul 03, 2006 8:29 am
Location: Idaho Falls, Idaho
Realm: Doomhammer (PvE) - US


Return to SigGen

Who is online

Users browsing this forum: No registered users and 0 guests

cron