Offsite hosted Image resizing in e107 forums (Resolved)

e107 CMS » Forums » e107 v1.x Support » Core Code Support << Previous thread | Next thread >>
Go to page  1 2 3 ... 7 8 9 10 11
Draeghonov
Apr 13 2009, 05:54AM
Registered Member #50836
Joined: Apr 13 2009, 05:51AM
Posts: 13
oh dear... sorry, but I have to bump this thread again, SORRY!!!
I have e107 v0.7.15, and none of the posted solutions work...
here's a link to one of my topics:
[-link-]
I have installed mrj's file, but it doesn't seem to work...
Does anyone have an idea?
thanks in advance, Dave
Go to top
veskoto
Apr 13 2009, 06:59AM
  • e107 Translation Team
  • e107 Design Team
Registered Member #34155
Joined: Feb 22 2007, 05:10AM
Location: Bulgaria
Posts: 634
admin > forum > Preferences > Maximum width of uploaded image - put 200px and Create link to full size image - put it on
or you can use
[img:width=500&height=685]link to large image[/img]

when you post external images
Go to top
Website
Draeghonov
Apr 13 2009, 07:27AM
Registered Member #50836
Joined: Apr 13 2009, 05:51AM
Posts: 13
YAY!!!!!!!!!
thanks!!! this works perfect!!!!

Thanks again:)
Go to top
janvi
Apr 22 2009, 03:52AM
Registered Member #46600
Joined: Aug 02 2008, 12:26PM
Location: Bergen, Norway
Posts: 125
This is my well-working solution for external images (via ordinary bb-code button)

Backup your img.bb file. ( [-link-] )

Replace with this file:


global $pref;
if (trim($code_text) == "") return ""; 						// Do nothing on empty file
if (preg_match("#\.php\?.*#",$code_text)){return "";}
global $IMAGES_DIRECTORY, $FILES_DIRECTORY, $e107;
$search = array('"', '{E_IMAGE}', '{E_FILE}', 'http://e107.org/e107_images/', 'http://e107.org/e107_files/');
$replace = array(''', $e107->base_path.$IMAGES_DIRECTORY, $e107->base_path.$FILES_DIRECTORY, $e107->base_path.$IMAGES_DIRECTORY, $e107->base_path.$FILES_DIRECTORY);
$code_text = str_replace($search, $replace, $code_text);
unset($imgParms);
$imgParms['class']="bbcode";  
$imgParms['alt']='';

$code_text = $tp -> toAttribute($code_text);

if($parm)
{
    $parm = preg_replace('#one<i></i>rror *=#i','',$parm);
    $parm = str_replace("amp;", "&", $parm);
    parse_str($parm,$tmp);
    foreach($tmp as $p => $v)
	{
        $imgParms[$p]=$v;
    }
}
$parmStr="";
foreach($imgParms as $k => $v)
{
    $parmStr .= $tp -> toAttribute($k)."='".$tp -> toAttribute($v)."' ";
}

// Only look for file if not a url - suspected bug in PHP 5.2.5 on XP
if((strpos($code_text,'../') === FALSE) && (strpos($code_text,'://') === FALSE) && file_exists(e_IMAGE."newspost_images/".$code_text))
{
    $code_text = e_IMAGE_ABS."newspost_images/".$code_text;
}
if (varsettrue($pref['image_post']) && check_class($pref['image_post_class']))
{
	return "<a href=javascript:open_window('".$code_text."',800,850) /><img src='".$code_text."' title='Click image for fullsize pic' BORDER=0 ></a>";
}
switch ($pref['image_post_disabled_method'])
{
	case '1' :
		return CORE_LAN17;
	case '2' :
		return '';
}
return CORE_LAN18.$code_text;


This add a link to the image (fullsize)

We now need limit the size of viewed image. Just add this in your themes style.css.
img {
border: 0px; max-width: 400px; 
}


Users will now be able to use the bb-button (in eg. forums, submitnews, content, and so on..) without breakage of the layout.
As a bonus, visitors are offered fullsize image by clikking the image inserted by bb-code button.

This is a feature MY users like.

[ Edited Apr 22 2009, 03:53AM ]
Go to top
migs
Apr 22 2009, 08:11AM
Registered Member #41706
Joined: Dec 04 2007, 02:19PM
Location: Warrington, UK
Posts: 274
Janvi

I get this error with your code -

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting ')' in /*fullpath*/e107_handlers/bbcode_handler.php(298) : eval()'d code on line 8
Go to top
C6Dave
Apr 22 2009, 08:16AM
  • e107 Site administrator
  • e107 Support Team Leader
Registered Member #9506
Joined: Jul 31 2004, 12:57AM
Location: North East UK
Posts: 12377
Photobucket et al supply code that users simply paste onto the page which defeats the bbcode button hack I'm afraid so not a 100% solution
Go to top
Website
janvi
Apr 22 2009, 08:28AM
Registered Member #46600
Joined: Aug 02 2008, 12:26PM
Location: Bergen, Norway
Posts: 125
Working fine here.

I'll have to search through my 'hack-list' I'll get back to you then.
Go to top
C6Dave
Apr 22 2009, 08:29AM
  • e107 Site administrator
  • e107 Support Team Leader
Registered Member #9506
Joined: Jul 31 2004, 12:57AM
Location: North East UK
Posts: 12377
The parser changed one element:

$replace = array(''', $e107->base_path.$IMAGES_DIRECTORY


the centre ' of the 3 ''' after array( should actually be written & # 039; (no spaces) look at the original img.bb to see what I mean
Go to top
Website
janvi
Apr 22 2009, 08:31AM
Registered Member #46600
Joined: Aug 02 2008, 12:26PM
Location: Bergen, Norway
Posts: 125
2dopey wrote ...

Photobucket et al supply code that users simply paste onto the page which defeats the bbcode button hack I'm afraid so not a 100% solution


Does'nt photobucket allowing users to paste <img url> the ordinary way?

_________

Ok hehe,
[ Edited Apr 22 2009, 08:33AM ]
Go to top
migs
Apr 22 2009, 01:33PM
Registered Member #41706
Joined: Dec 04 2007, 02:19PM
Location: Warrington, UK
Posts: 274
Thanks to Janvi and 2dopey, this now works.

It even works with Photobucket. I c&p the [ img] code they very kindly supplied, and voila!

Thanks to all.

2d, I know marj has resisted putting this in the core but, in the words of Morrissey "Please please please, let me get what I want. Lord knows, it would be the first time".

Thanks again to janvi. As we all know, members don't understand the implications of posting huge pics, and this helps tremendously.
Go to top
C6Dave
Apr 22 2009, 03:07PM
  • e107 Site administrator
  • e107 Support Team Leader
Registered Member #9506
Joined: Jul 31 2004, 12:57AM
Location: North East UK
Posts: 12377
Please don't quote Morrisey, we'll get suicidal
Go to top
Website
janvi
Apr 22 2009, 04:07PM
Registered Member #46600
Joined: Aug 02 2008, 12:26PM
Location: Bergen, Norway
Posts: 125
I have made a download of this hack, included instructions.

BBcode image with autolink. Limited size. [-link-]
Go to top
marj
Apr 23 2009, 02:38AM
marj
Registered Member #1159
Joined: Mar 16 2003, 08:00AM
Posts: 6161
migs wrote ...
2d, I know marj has resisted putting this in the core but, ...

You must be mistaken, I actually have nothing to do with what's in the core or not as I'm not in the devteam
Go to top
migs
Apr 23 2009, 02:51AM
Registered Member #41706
Joined: Dec 04 2007, 02:19PM
Location: Warrington, UK
Posts: 274
My mistake marj, no offence intended. I think, because the likes of you and 2d are so involved on the support side, we forget that you're not devs.

Again, no offence intended.
Go to top
19PowerS
Apr 23 2009, 03:24AM
Registered Member #50947
Joined: Apr 21 2009, 04:36AM
Posts: 3
Problem enabling unpload image ??
Excuse my English!


I need help aid had negra trained unpload images to upload to the forum, although I may add that the show unfortunately but not inserted
completely nothing?

What should I do to enable?
Do you still have to add in plugins? That will work.
Thanks for the reply !!

My website : [-link-]
Go to top
George007890
Apr 24 2009, 05:00AM
Registered Member #51002
Joined: Apr 24 2009, 04:58AM
Posts: 1
Hi,

This is a wonderful opinion. The things mentioned are unanimous and needs to be appreciated by everyone.

George,

Business Forums
[ Edited Apr 24 2009, 06:12AM ]
Go to top
laserlight
May 05 2009, 10:53AM
Registered Member #49328
Joined: Jan 18 2009, 10:19AM
Posts: 3
Janvi's code worked...too well. It started shrinking my banners.
EDIT: Would it be possible to make a second IMG tag? Like make IMG2 tag with appropriate bbcode, and max-width css. And then add the button, beside the default image button and change text to say "For large images."
[ Edited May 05 2009, 11:02AM ]
Go to top
marj
May 05 2009, 01:41PM
marj
Registered Member #1159
Joined: Mar 16 2003, 08:00AM
Posts: 6161
of course
Go to top
migs
May 10 2009, 10:37AM
Registered Member #41706
Joined: Dec 04 2007, 02:19PM
Location: Warrington, UK
Posts: 274
Okay, a new one.

Firefox does everything perfectly well. IE8, on the other hand, simply resizes the image but leaves it within the original, full size container, breaking the layout. Given the history of MS/IE, and their willingness to just plough on with things that don't work properly, I probably shouldn't be surprised

I have no idea about IE7 but I suspect the same.
Go to top
migs
May 11 2009, 01:08PM
Registered Member #41706
Joined: Dec 04 2007, 02:19PM
Location: Warrington, UK
Posts: 274
Forget that, it's the old IE8 compatibility thing.
Go to top
Go to page  1 2 3 ... 7 8 9 10 11  

Jump:     Back to top

Syndicate this thread: rss 0.92 Syndicate this thread: rss 2.0 Syndicate this thread: RDF
Powered by e107 Forum System