miniBB ® 

miniBB

®
Support Forums
  
 | Start | Register | Search | Statistics | File Bank | Manual |
Specific miniBB Support Forums / Specific /  
 

Post Editing Issue with Uploaded image

 
Author Steve Shaw
Partaker
#1 | Posted: 12 Sep 2017 14:15 
We are having an issue with editing pictures uploaded via the 'Upload a File' option.
When the picture is added via a URL link all is ok.
(And the smilies are ok too...)

But after editing changes to:

<img src="https://www.7-dna.com/forums/shared_files/storage/2017/tmb/20161206_154242.jpg" alt="Piccy" title="Piccy" />
This seems to have started after we went to https:// Secure hosting.

Do you have any ideas?
Hope you can help!

Steve

Author kuopassa
Partaker
#2 | Posted: 12 Sep 2017 14:20 
I'm somewhat sure the problem is in bb_codes.php. That's the file where those BBCode tags are defined. The code that handles BBCode to HTML and vise versa needs some fix... And at this point I leave the stage for Paul. :-)

Author Paul
Lead Developer 
#3 | Posted: 13 Sep 2017 10:58 
I suppose you need to check [img] tag in the decodeBB function and make sure it's pattern supports https. This pattern should start with something similar [url] code starts from.

Author Steve Shaw
Partaker
#4 | Posted: 23 Sep 2017 20:44 
Ok - I've found the 'decodeBB' function...
But, what do I need to do?
(I really am useless at this stuff...)

Steve

Author Paul
Lead Developer 
#5 | Posted: 23 Sep 2017 22:01 
Post here the contents of that function you have.

Author Steve Shaw
Partaker
#6 | Posted: 24 Sep 2017 12:08 
//--------------->
function deCodeBB($msg) {

$pattern=array(); $replacement=array();

$pattern[]="/<!-- nourl -->([^<> \n\r]+?)<!-- \/nourl -->/i";
$replacement[]="\\1";

/* Old [IMG] tag code - without fixed width. */
$pattern[]="/<img src=\"([^<> \n\r\[\]&]+?)\" alt=\"\" (title=\"\" )?\/>/i";
$replacement[]="[img]\\1[/img]";

/* New [IMGs] tag code - with fixed width */
$pattern[]="/<a href=\"([^<> \n\r\[\]&]+?)\" target=\"_blank\"(".addslashes($GLOBALS['relFollowUrl']
).")?>[ ]<img src=\"([^<> \n\r\[\]]+?)\" alt=\"\" (title=\"\" )?style=\"width:[0-9]+px\" \/><\/a>/i";
$replacement[]="[imgs]\\3[/imgs]";

/* [IMGS] tag code - with fixed width and alt */
$pattern[]="/<a href=\"([^<> \n\r\[\]&]+?)\" target=\"_blank\"(".addslashes($GLOBALS['relFollowUrl']
).")?>[ ]<img src=\"([^<> \n\r\[\]]+?)\" alt=\"(.+?)\" (title=\"(.+?)\" )?style=\"width:[0-9]+px\" \/><\/a>/i";
$replacement[]="[imgs=\\3]\\4[/imgs]";

/* [IMG] tag code - without fixed width, with alt. */
//$pattern[]="/<img src=\"([^<> \n\r\[\]&]+?)\" alt=\"(.+?)\" (title=\"(.+?)\" )?\/>/i";
//$replacement[]="[img=\\1]
\\2[/img]";

$pattern[]="/<a href=\"([^<> \n\r\[\]]+?)\" target=\"(_new|_blank)\"".addslashes($GLOBALS['relFollowUrl']).">(.+?)<\/a>/i";
$replacement[]="[url=\\1]\\3[/url]";

if($GLOBALS['user_id']==1 or (isset($GLOBALS['isMod']) and $GLOBALS['isMod']==1)){
$pattern[]="/<a href=\"([^<> \n\r\[\]]+?)\" target=\"(_new|_blank)\">(.+?)<\/a>/i";
$replacement[]="[urlc=\\1]\\3[/url]";
}
else{
$pattern[]="/<a href=\"([^<> \n\r\[\]]+?)\" target=\"(_new|_blank)\">(.+?)<\/a>/i";
$replacement[]="[url=\\1]\\3[/url]";
}

$pattern[]="/<strong>(.+?)<\/strong>/is";
$replacement[]="[b ]\\1[/ b]";

$pattern[]="/<em>(.+?)<\/em>/is";
$replacement[]="[i ]\\1[/ i]";

$pattern[]="/<[uU]>(.+?)<\/[uU]>/s";
$replacement[]="[u ]\\1[/ u]";

$pattern[]="/<span style=\"color:(#[A-F0-9]{6})\">(.+?)<\/span>/is";
$replacement[]='[font\\1]\\2[/font]';

$pattern[]="/<div style=\"text-align:(left|right|center)\">(.+?)<\/div>/is";
$replacement[]='[align\\1]\\2[/align]';

$pattern[] = '/<div class=\"quote\"><div class=\"quoting\">(.+?): <\/div>(.+?)<\/div>/is';
$replacement[] = "[ quote=\\1]\\2[/ quote]\n";

$pattern[] = '/<div class=\"quote\">(.+?)<\/div>/is';
$replacement[] = "[ quote]\\1[/ quote]\n";

$pattern[] = '/<div class=\"hl\">(.+?)<\/div>/is';
$replacement[] = "[ hl]\\1[/ hl]\n";

Author Steve Shaw
Partaker
#7 | Posted: 24 Sep 2017 12:13 
I had to add a couple of spaces in the 'quote' and 'h1' components or they were seen as BB codes.
(Oh! the 'b' (bold) item is still wrong...)

Steve

Author Paul
Lead Developer 
#8 | Posted: 24 Sep 2017 13:44 
Well, we have a file bank, you could just zip your codes and upload as a standalone file :)

Anyway, in "IMG tag code without fixed width with alt" you have both codes below commented. So far I'm not quite sure why it is so, but if you remove 2 slashes in front (uncomment these codes), they possibly will work.

Author Steve Shaw
Partaker
#9 | Posted: 28 Sep 2017 17:49 
I think you made that change for us - one of the alterations we paid for?
(To make all images on the site a fixed width thumbnail?)

We do not want the images as zip files - they need to be seen within the page they are posted to.
(I actually don't understand that comment - am I missing something?)

Does that make sense?

Author tom322
Active Member
#10 | Posted: 28 Sep 2017 18:51 
From my experience I would not suggest to edit such crucial functions (unless you know 100% what you're doing and have a backup). Even one extra character or space can screw things up. If you change something then it's easy to blame someone else when something doesn't work and in most cases the problem was you (or me ;).

Author Paul
Lead Developer 
#11 | Posted: 29 Sep 2017 12:39 
Steve Shaw:
We do not want the images as zip files - they need to be seen within the page they are posted to.
(I actually don't understand that comment - am I missing something?)
I was meaning that on our forum, if you provide the PHP code, you could zip it and upload as a file. Not to post the code directly.

Anyway, I must say sorry 'cause I don't remember what your task was about. How many years ago it was done? I couldn't be sure. But you could definitely try to uncomment the code I've mentioned, and check your issues incl. that customized approach. If it won't work, then something else needs to be tried out.

Author Steve Shaw
Partaker
#12 | Posted: 4 Oct 2017 19:27 
Ah - sorry!
Now I understand the 'zip' issue.
Anyway. the work you performed was some time back.
It was to fix the size of images displayed on the forum to a set size, as otherwise we we getting large images that were beyond the page size.
(And we have a lot of image use on our forum).

I'll test the 'uncommenting' but am concerned it will break the fix you did for us.

Steve

Author Paul
Lead Developer 
#13 | Posted: 4 Oct 2017 21:51 
Steve Shaw:
It was to fix the size of images displayed on the forum to a set size, as otherwise we we getting large images that were beyond the page size.
Hmm... I suppose, these days it could be done via CSS. At least in the newer miniBB version's CSS I've put this:

.postedText img{
max-width:100%;
}
Obviously we did some changes truly a lot of time ago :) I suppose, you could try the mod I've suggested above, and put that code above to your CSS file to if it all works altogether (but you also must be sure you have this "postedText" class in templates/main_posts_cell.html).

Author Steve Shaw
Partaker
#14 | Posted: 24 Oct 2017 11:28 
Sorry for the delay in replying, but the changes you suggested seem to have worked!
Thanks.

Steve

Author Paul
Lead Developer 
#15 | Posted: 24 Oct 2017 15:13 
As I don't remember exactly what this change was related to, watch your forum and report here if you find some other issue related to images...

Specific miniBB Support Forums / Specific /
 Post Editing Issue with Uploaded image
 Share Topic's Link

Your Reply Click this icon to move up to the quoted message


  ?
Post as a Guest, leaving the Password field blank. You could also enter a Guest name, if it's not taken by a member yet. Sign-in and post at once, or just sign-in, bypassing the message's text.


Before posting, make sure your message is compliant with forum rules; otherwise it could be locked or removed with no explanation.

 

 
miniBB Support Forums Powered by Forum Software miniBB ® Home  Features  Requirements  Demo  Download  Showcase  Gallery of Arts
Compiler  Premium Extensions  Premium Support  License  Contact Us
Try the Captcha add-on: protect your miniBB-forums from the automated spam and flood.


  ⇑