News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Remove Quoted Images v1.0

Started by karlbenson, December 26, 2007, 06:06:11 PM

Previous topic - Next topic

karlbenson

WDM2005 has now taken over development of this mod.
The link for which is http://custom.simplemachines.org/mods/index.php?mod=1302


REMOVE QUOTED IMAGES v1.0
By Karl Benson

Link to Mod | Support Topic | Demo | Donate

Compatibility
For SMF 1.1.x and SMF 2.0 Beta 1

Introduction
Replaces images which have been 'quoted' with a text-string.

Features
o Replaces quoted images with text <Quoted Image Removed>
o Uninstall mod to reveal quoted images again
o Ignores smilies
o Supports Languages
- English/English-utf8
- English_British/English_British-utf8
I welcome translations for other languages. Please post the translated language strings in the Support Topic.

Installation
Installs for SMF Default Core Theme.

It should also install automatically for ALL other themes, EXCEPT if your theme has its own versions of the language files Modifications.english.php and/or Modifications.english-utf8.php, OR if your using a language other than those supported (listed above) by the mod.

All you would have to do is add (and translate if necessary) the language string
$txt['quotedimage_removed'] = '<Quoted Image Removed>';
into
Themes/default/Languages/Modifications.{language}.php
and if your using utf8 character set also copy it into
Themes/default/Languages/Modifications.{language}-utf8.php

Useful Links
SMF Package Parser
Manual Installation Of Mods
How Do I Modify Files?

Donate
Has this modification helped you? Support the developer by Donating

Support
Please use the modification thread for support with this modification.
(Please don't ask me to do the edits for you)

Changelog
1.0 - 23rd December 2007
o Initial Release

[кѕ]ваηε-σ

could this mod be changed to include Youtube videos?

I was wondering if this could undo the YouTube auto-embed mod you made in quotes. cause that would be awsome.


Right now i just have to go back to every post and add the [code][/code] tags to th videos that get quoted, and that gets tiring and i miss a few sometimes....

Click my sig, I dare you. (you might enjoy it)


I have 1337 M0DЄЯΑŦ0Я ѕκιŁŁѕ.


Quote from: ваηε-σ, #lëñņðN`, мµŋτς[02:42] [кѕ]ваηε-σ: I just pwned microsoft and completely ghosted one hard drive onto another. Two computers with the exact same operating system, exact same everything.
[02:42] ⌠Ķζ⌡мµŋτς ©  / DarkForce: lmfao, XD
[02:43] *[Ҝﮘ] #lëñņðN` ¨εﮘ`: hahahaha, noice

karlbenson

use [noembed] bbcode to prevent auto embed video mod being quoted

[кѕ]ваηε-σ

thank you, that's really helpfull. i was just wondering if you could add that into this mod so it would automatic

Click my sig, I dare you. (you might enjoy it)


I have 1337 M0DЄЯΑŦ0Я ѕκιŁŁѕ.


Quote from: ваηε-σ, #lëñņðN`, мµŋτς[02:42] [кѕ]ваηε-σ: I just pwned microsoft and completely ghosted one hard drive onto another. Two computers with the exact same operating system, exact same everything.
[02:42] ⌠Ķζ⌡мµŋτς ©  / DarkForce: lmfao, XD
[02:43] *[Ҝﮘ] #lëñņðN` ¨εﮘ`: hahahaha, noice

karlbenson

I may look at adding something in my auto embed video mod.

But this one is just for images in quoted, by request.

edi67

sorry Karl but in SUBS.php i not have this line:

$message = strtr($message, array('  ' => ' &nbsp;', "\r" => '', "\n" => '<br />', '<br /> ' => '<br />&nbsp;', '' => "\n"));

but i have this as in default:
$message = strtr($message, array('  ' => ' &nbsp;', "\r" => '', "\n" => '<br />', '<br /> ' => '<br />&nbsp;'));

CrazyZone - My SMF Forum


From the difficult the hardening of the man you can see

karlbenson

The following is the in DEFAULT line in subs.php for BOTH 1.1.4 and 2.0 beta 1/1.1.  Yours may have been modified by something else.

// Cleanup whitespace.
$message = strtr($message, array('  ' => ' &nbsp;', "\r" => '', "\n" => '<br />', '<br /> ' => '<br />&nbsp;', '' => "\n"));

MothMan

I have the same line is subs as edi67 does, resulting in my install attempt showing me an error for subs.php.

To carry on with the install attempt, I edited the mod install.xml to search for the actual line in my subs file.

That removed the error message for subs.php, but having gotten through that, the test install (ie. Applying mod, and checking thr error/success report before actually installing it) now shows an error of:

1.     Execute Modification     -     Modification parse error


It also fails in the SMF Package Parser, showing:

Fatal error: Uncaught exception 'Exception' with message 'String could not be parsed as XML' in /home/groups/modparser/htdocs/index.php:450 Stack trace: #0 /home/groups/modparser/htdocs/index.php(450): SimpleXMLElement->__construct('') #1 /home/groups/modparser/htdocs/index.php(419): parseModificationXML('/tmp/smf_xml/in...', Object(SimpleXMLElement), 'all') #2 /home/groups/modparser/htdocs/index.php(94): parsePackageInfoXML('/tmp/smf_xml/pa...', 'install', 'all') #3 /home/groups/modparser/htdocs/index.php(735): parseArchive('/tmp/phpJyZBSy', 'install', 'all') #4 {main} thrown in /home/groups/modparser/htdocs/index.php on line 450


Any ideas?

karlbenson

I've no idea, you can break the installer by changing it in a million ways.

The best bet would be to try installing, ignore the failure, the manually add the edit where the file is different.

karlbenson

Mothman did you manage to get it resolved?

mark7144

#10
Nice mod Karl but can I propose that you add an optional feature that has it so instead of removing the image, you still quote it but it automatically gets resized to 100x100 for example, this could be done in javascript maybe.

I say this because then the reader will actually know what image is being quoted and it won't be annoying to see it again.

karlbenson

I have reuploaded this mod and screenshots for it.

I am in the process of doing it for ALL my other mods aswell.  Please bear with me.

mark7144

Any chance of implementing the feature I asked for? ;)

karlbenson

Mark, I had a look into it.
I can't see myself creating it or implementing it as an option.
It would be a pain to get it proportionally resized.
Besides the fact I've got a tonne of mods. And this is right down to the bottom of my priority list.

If you still want it, I'd recommend you raise it as a new mod request.

mark7144

OK Karl, thanks for taking a look.

BTW, I was suggesting having it proportionally resized but just have all the images resized to 100x100 which would be good enough to give the reader an idea of what the original photo was.

Hoe-zo

Hello Karlbenson,

I've an question.
Is it possible to change the plaint text that is the replacement for the picture, to a [link] option that hyperlinks to the location of the picture?

I mean it by this:

normal: [img ] picture [/ img]
after your mod: <Quoted image removed>
my idea: [url = location of picture/picture] [link] [/ url]
OR
[url = location of picture/picture] Link [/ url]

Is it possible to make a change of that? or is it only a string i have to change?
Website/forum: http://www.hoe-zo.net

karlbenson

#16
Its not that easy to do.

Edit: I've not actually been happy with this mod. With nested quotes it wouldn't work properly.

Hoe-zo

#17
Quote from: karlbenson on May 14, 2008, 08:16:09 PM
Its not that easy to do.

Edit: I've not actually been happy with this mod. With nested quotes it wouldn't work properly.


The mod is working properly at my forum, so far nu problems..

hmm that's a pitty. I thought it was only replace the code for the < and > to something else, but what a friend gave me was this:

You have to modify the messsage "before" the messagescreen, but i don't know where to modify..

<?php
function imageToUrl($input){
 
$regex '~\[img ]http://(.+?)\[/img]~i';
 while(
preg_match($regex,$input)){
  
$input preg_replace($regex,$input,'[url=http://$1][afbeelding][/url]');
 }
}


This is usable to messages in the quotes (i've no idea to put), like this:

$output = imageToUrl($output);


Maybe you can make cheese of it (yes i'm Dutch ;) )
Website/forum: http://www.hoe-zo.net

karlbenson

Sources/Subs.php
(with my mod installed)
FIND

$quoteblock[1] = preg_replace('~<img src="(?:(?!'. preg_quote($modSettings['smileys_url'], '~') .').*?)"(?:.*?)\/>~is'.($context['utf8'] ? 'u' : ''), $txt['quotedimage_removed'], $quoteblock[0]);

REPLACE
$quoteblock[1] = preg_replace('~<img src="((?!'. preg_quote($modSettings['smileys_url'], '~') .')[^"]*?)"(?:.*?)\/>~is'.($context['utf8'] ? 'u' : ''), '<a href="$1">$1</a>', $quoteblock[0]);

Hoe-zo

Thank you for your reply, i want to thank you for the simple adjustment of your mod..

I'm very happy and i hope other people are helped by this solution..
Website/forum: http://www.hoe-zo.net

Advertisement: