Generating UBBCODE for pasting links on forums

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
L etranger
Posts: 2
Joined: Thu May 26, 2005 1:08 am

Generating UBBCODE for pasting links on forums

Post 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
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Generating UBBCODE for pasting links on forums

Post 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
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
L etranger
Posts: 2
Joined: Thu May 26, 2005 1:08 am

Post 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.
Post Reply