PDA

View Full Version : automatic change large image form [img] to [bimg]


home9000
03-30-2012, 06:48 AM
I do not know if there is hack can do :

automatic change large image form [img] to [bimg]

BirdOPrey5
03-30-2012, 03:56 PM
There are a number of image resizer mods out there that will resize large images automatically- I've never seen a separate bbcode for big images.

home9000
03-30-2012, 06:31 PM
thanks BirdOPrey5 for your fast reply

I do not want to resize the image
I need to make image as link if it's large so the page will load faster
I think this will be good for SEO

BirdOPrey5
03-30-2012, 07:20 PM
OK well at least I understand the logic now.

This would be pretty easy to do be editing the bbcode file but the problem is it would need to request the file size of remote files on every page load, from a remote server. That will likely lead to much longer times for page loads, not save any time.

Thinking out loud the only practical way to do this would be when the new post is first saved- do a check for each image and if it is bigger than X bytes in size replace the [img] code with [url] code. This way the delay is only going to happen when a user submits a new post.

The major limit of this would be that if the remote file changed from a small image to a big image (or big to small) the post would remain hard-coded as an image or url based on when the post was first made. Someone would need to manually edit the post to fix that if it was a problem.

Does [bimg] bbcode you talk about do anything different then a regular [url] bbcode?

home9000
03-30-2012, 07:42 PM
I agree with you BirdOPrey5, The only way to do it have to be when the new post is first saved

[bimg] = regular [url] bbcode

if it's difficult to know the file size then the image dimension is ok

changing the file later I think will be rear for most of the cases so we can ignore it

BirdOPrey5
03-30-2012, 09:54 PM
File size will be easier to find then the dimensions, and file size is more important on how fast a page loads anyway. I see an admincp setting where you can set the max file size in kilobytes and any images larger than that value will be replaced with links instead. If I get fancy maybe I'll put the file-size next to the link. Like....

[url]http://somedomain.com/image.jpg (251 kb)


I will probably play with this but no promises on how soon I can do it- if someone else comes along willing to try it I will gladly defer to them.

home9000
03-31-2012, 03:08 AM
Thanks BirdOPrey5

hopefully you do it by yourself
I prefer if you make it like

Large Image (http://somedomain.com/image.jpg) (251 kb)

BirdOPrey5
04-15-2012, 10:31 PM
Check it out: https://vborg.vbsupport.ru/showthread.php?p=2320457#post2320457 :)

home9000
04-19-2012, 07:31 AM
Thanks BirdOPrey5

Well done :D