Convert quoted images to url

All new MODs released in our MOD Database will be announced in here. All support for released MODs needs to take place in the Customisations Database.
Forum rules
READ: phpBB.com Board-Wide Rules and Regulations

NOTICE: This forum is only for the announcement of new releases and/or updates of MODs. Any MOD support should be obtained through the Customisations Database in the support area designated for each MOD.

A direct link to support for each MOD is in the first post of the respective topic.
User avatar
Ger
Registered User
Posts: 2117
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100

Re: Convert quoted images to url

Post by Ger »

You tried the patch in post#3?
My extensions:
Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update, Modern Quote, Quoted Where (GDPR) and Autoresponder.
Newest: FAQ manager for 3.2

Like my work? Buy me a coffee to keep it coming. :ugeek:

-Don't PM me for support-
User avatar
spicyapple
Registered User
Posts: 58
Joined: Wed Apr 23, 2008 3:53 am

Re: Convert quoted images to url

Post by spicyapple »

It works great! Thanks a lot. :) This hides the URL which I think some of my members would prefer. :mrgreen:
Quatrerwin
Registered User
Posts: 1
Joined: Fri Jan 25, 2008 6:39 pm

Re: Convert quoted images to url

Post by Quatrerwin »

edit: it seems to be working now
Stoepsel
Registered User
Posts: 395
Joined: Sun Oct 23, 2005 11:23 am

Re: Convert quoted images to url

Post by Stoepsel »

This mod (including the patch in post #3) does not replace images that occur after a nested quote.

Example:
Outer Quote wrote:image1
Inner Quote wrote:image 2
image 3
In cases like this, image 1 and image 2 are replaced but image 3 is not. I'm guessing that it has to do with the ungreedy preg matching that matches up to the first closing quote tag of the inner quote.

Do you see a way to fix this?
User avatar
Ger
Registered User
Posts: 2117
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100

Re: Convert quoted images to url

Post by Ger »

I didn't really take that into account, because with this MOD it's impossible to quote something like that (since you'd have to quote a message with a quoted image, wich couldn't be posted in the first place). The user should manually put in the extra image to accomplish this.

Now I'm guessing you encountered this error because you quoted a message wich is posted before you installed this MOD? That former message isn't altered by this MOD because it does the job when a message is parsed. Everything already in the database isn't affected by this MOD. What you could do is try and run Admin reparse BBcode, a very simple MOD that reparses all your posts (still in BETA, so read the issues).
My extensions:
Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update, Modern Quote, Quoted Where (GDPR) and Autoresponder.
Newest: FAQ manager for 3.2

Like my work? Buy me a coffee to keep it coming. :ugeek:

-Don't PM me for support-
User avatar
RupertGee
Registered User
Posts: 5
Joined: Fri Dec 05, 2008 11:23 pm
Location: Singapore

Re: Convert quoted images to url

Post by RupertGee »

MOD Robot wrote: Download file: convert_quoted_images_to_url_1.0.1.zip
File size: 29733 Bytes
Hello

The content of the above zip is for the "Quote Removal ver 1.0.0" mod. :(
User avatar
Ger
Registered User
Posts: 2117
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100

Re: Convert quoted images to url

Post by Ger »

Seems only the version information at the top isn't changed, but when you open MOD history, you'll see its 1.0.1.

It definitely doesn't say "quote removal". ;)
My extensions:
Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update, Modern Quote, Quoted Where (GDPR) and Autoresponder.
Newest: FAQ manager for 3.2

Like my work? Buy me a coffee to keep it coming. :ugeek:

-Don't PM me for support-
User avatar
RupertGee
Registered User
Posts: 5
Joined: Fri Dec 05, 2008 11:23 pm
Location: Singapore

Re: Convert quoted images to url

Post by RupertGee »

Ger wrote:Seems only the version information at the top isn't changed, but when you open MOD history, you'll see its 1.0.1.

It definitely doesn't say "quote removal". ;)
Thanks. The same download link nows gets me the correct mod.
User avatar
RupertGee
Registered User
Posts: 5
Joined: Fri Dec 05, 2008 11:23 pm
Location: Singapore

Re: Convert quoted YouTube to url

Post by RupertGee »

This is a great mod; images in quotes are so annoying.

My board also lets users post YouTube video. That means the video gets quoted too! Argh! So I modded this mod to take care of YouTube too, converting the embedded video player to a text link when quoted. It's my first mod-of-mod.... :)

Look for:

Code: Select all

$qres = preg_replace('#\[img\](.*)\[/img\]#iU', '[ [url=\1]'. $user->lang['IMAGE'] .'[/url] ]', $qmatchin);
Add after:

Code: Select all

$replacement = preg_replace('#\[youtube\]\n*(.*)\n*\[/youtube\]#iU', '[url=$1]Writer posted a YouTube video[/url]', $replacement); // RupertGee Addition
My board supports English only and so I hardcorded the text link; you'll want to change that to language specific text for your multi-lingual board.
You do not have the required permissions to view the files attached to this post.
User avatar
Ger
Registered User
Posts: 2117
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100

Re: Convert quoted images to url

Post by Ger »

Good job!
My extensions:
Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update, Modern Quote, Quoted Where (GDPR) and Autoresponder.
Newest: FAQ manager for 3.2

Like my work? Buy me a coffee to keep it coming. :ugeek:

-Don't PM me for support-
Kharon
Registered User
Posts: 235
Joined: Thu Oct 26, 2006 5:27 pm

Re: Convert quoted images to url

Post by Kharon »

1. quote : image is converting to url
2. quote : image is not converting to url ?

thank you

@RupertGee , thank you very nice addon (gvideo etc.)
Image
User avatar
Ger
Registered User
Posts: 2117
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100

Re: Convert quoted images to url

Post by Ger »

Have you already tried this?
My extensions:
Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update, Modern Quote, Quoted Where (GDPR) and Autoresponder.
Newest: FAQ manager for 3.2

Like my work? Buy me a coffee to keep it coming. :ugeek:

-Don't PM me for support-
Kharon
Registered User
Posts: 235
Joined: Thu Oct 26, 2006 5:27 pm

Re: Convert quoted images to url

Post by Kharon »

yes,I tried

two quote (+) is not working,I don't understand .. :roll:


thank you
User avatar
Ger
Registered User
Posts: 2117
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100

Re: Convert quoted images to url

Post by Ger »

I see. I identified the problem, also know the source of it. It's because the MOD searches for a quote-endtag and then stops. In your example, it finds the endtag of the inner quote and therefore doesn't handle images after that one.

I didn't really take that into account, because with this MOD it's impossible to quote something like that (since you'd have to quote a message with a quoted image, wich couldn't be posted in the first place). The user should manually put in the extra image to accomplish this.

Now I'm guessing you encountered this error because you quoted a message wich is posted before you installed this MOD? That former message isn't altered by this MOD because it does the job when a message is parsed. Everything already in the database isn't affected by this MOD. What you could do is try and run Admin reparse BBcode, a very simple MOD that reparses all your posts (still in BETA, so read the issues).

An other solution could be, but be cautious with this is to alter ./posting.php:

FIND

Code: Select all

if ($mode == 'quote' && !$submit && !$preview && !$refresh)
{
	$message_parser->message = '[quote="' . $post_data['quote_username'] . '"]' . censor_text(trim($message_parser->message)) . "[/quote]\n";
}
REPLACE WITH

Code: Select all

//Start SFB MOD convert quoted images to url
if ($mode == 'quote' && !$submit && !$preview && !$refresh)
{
   $inmessage = censor_text(trim($message_parser->message));
   preg_match_all('#\[code\](.*?)\[/code\]#is', $inmessage, $qcode);
   $crepl = str_replace('[img]', '[img]', $qcode[1]);
   $replacement = str_replace($qcode[1], $crepl, $inmessage);
   $replacement = preg_replace('#\[url=\n*(.*(jpg|jpeg|gif|png|bmp))\n*\]\n*\[img\]\n*(.*)\n*\[/img\]\n*\[/url\]#iU', '[ [url=$1]'. $user->lang['IMAGE'] .'[/url] ]', $replacement);
   $replacement = preg_replace('#\[url=\n*(.*)\n*\]\n*\[img\]\n*(.*)\n*\[/img\]\n*\[/url\]#iU', '[ [url=$1]'. $user->lang['IMAGE'] .'[/url] ]', $replacement);
   $replacement = preg_replace('#\[img\]\n*(.*)\n*\[/img\]#iU', '[ [url=$1]'. $user->lang['IMAGE'] .'[/url] ]', $replacement);
   $inmessage = str_replace($inmessage, $replacement, $inmessage);
   $inmessage = str_replace($crepl, $qcode[1], $inmessage);
   $message_parser->message = '[quote="' . $post_data['quote_username'] . '"]' . $inmessage . "[/quote]\n";
}

/*
if ($mode == 'quote' && !$submit && !$preview && !$refresh)
{
	$message_parser->message = '[quote="' . $post_data['quote_username'] . '"]' . censor_text(trim($message_parser->message)) . "[/quote]\n";
}
*/
//End SFB MOD convert quoted images into url
Above does roughly the same as the MOD you've installed, but it strips images when hitting the quote-button in stead of when the final posting happens. Therefore, when a quoted message contains images, these images are already converted tot urls when you get to the posting-screen.
But as I said: be cautious. I guess it will work, but I don't have the opportunity to test this so if you try this: make sure you have a backup close at hand.
Last edited by Ger on Fri Dec 19, 2008 8:52 am, edited 1 time in total.
My extensions:
Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update, Modern Quote, Quoted Where (GDPR) and Autoresponder.
Newest: FAQ manager for 3.2

Like my work? Buy me a coffee to keep it coming. :ugeek:

-Don't PM me for support-
Kharon
Registered User
Posts: 235
Joined: Thu Oct 26, 2006 5:27 pm

Re: Convert quoted images to url

Post by Kharon »

I tested code five minutes ago, it is working but ..

posting.php

Code: Select all

[phpBB Debug] PHP Notice: in file /posting.php on line 1398: Array to string conversion
[phpBB Debug] PHP Notice: in file /posting.php on line 1398: Undefined variable: Array
[phpBB Debug] PHP Notice: in file /posting.php on line 1398: Array to string conversion
/posting.php on line 1398:

Code: Select all

$inmessage = str_replace($$crepl, $qcode[1], $inmessage);
thank you

Return to “[3.0.x] MOD Database Releases”