Page 1 of 1

Generating UBBCODE for pasting links on forums

Posted: Thu May 26, 2005 1:15 am
by L etranger
Hello

I m trying to make Serendipity displaying me a UBB code at the end of image upload process (for copy pasting my uploaded picture link on forums), like this :

Code: Select all

[url=myurl/serendipityimage][img]myurl/serendipityimagethumbnail[/img][/url]
What i did is :

Code: Select all

// Accept file
            if (move_uploaded_file($_FILES['userfile']['name'], $target)) {
                printf(FILE_UPLOADED . '<br />', $_FILES['userfile']['name'], $_FILES['userfile']['thumbnail_name'], $target);
And

Code: Select all

@define('FILE_UPLOADED', 'the BBCODE is :[url=http://myurl/%s][img]http://myurl/%s[/img][/url] Pictures successfully uploaded as %s');
But i m unable to make the thumbnail name to show or to find his cvars, i looked anything but i m novice in php and i don't want to mess my working Serendipity, i would be gratefull if there was a easy way that someone could higlight me.

Cheer

Re: Generating UBBCODE for pasting links on forums

Posted: Thu May 26, 2005 11:54 am
by garvinhicking
You can just use $serendipity['thumbSuffix'] thing which contains the additional thumbnail string.

Also have a look at the serendipity_makeThumbnail() command, it uses that variable to build the real thumbnail name. It's a bit of work to construct the full filename as you have to investigate the several parts of the filename.

A quick workaround would be to:

Code: Select all

$thumbfile = preg_replace('@\.(jpg|gif|png)@i', '.' . $serendipity['thumbSuffix'] . '.\1');
echo $thumbfile;
HTH,
Garvin

Posted: Thu May 26, 2005 4:48 pm
by L etranger
Thank for your help, but i think i don't have enough knowledge to follow you, i m still trying to understand how things are linked to understand your command.