Forum Software: Resize Huge Images to Improve Post Readability

  • Thread starter Thread starter turbo
  • Start date Start date
AI Thread Summary
The discussion centers on the challenges posed by large images in forum posts, particularly in the earthquake/nuclear reactor thread, which disrupts readability. Users are exploring whether the forum software can be configured to resize or reject oversized images, with some suggesting that server-side solutions may be complex. Alternatives like JavaScript for client-side resizing are proposed, allowing images to be scaled down in the browser without server intervention. There are concerns about the effectiveness of these solutions across different browsers and the potential for user confusion. Ultimately, the decision on how to handle large images rests with the forum's administrators.
turbo
Insights Author
Gold Member
Messages
3,157
Reaction score
57
Is it possible to get the forum software to either resize or reject huge images when people post them? The earthquake/nuclear reactor thread is riddle with them, and they blow up browser windows to the point that it is very difficult to read the posts.

Thanks.
 
Physics news on Phys.org
turbo-1 said:
Is it possible to get the forum software to either resize or reject huge images when people post them? The earthquake/nuclear reactor thread is riddle with them, and they blow up browser windows to the point that it is very difficult to read the posts.

This question came up before, I believe it can't be done simply as it would require the server to hold or process each image on load for sizing.

Thread should be around here somewhere.

EDIT: Here it is - https://www.physicsforums.com/showthread.php?t=432141
 
turbo-1 said:
Is it possible to get the forum software to either resize or reject huge images when people post them?

Report these posts please. I already did some cleaning and I am trying to react live, but - unlikely as it may sound - there are moments when I am away from my computer.
 
I think it may be possible to lower the allowed image size for attachments, not sure about for img tags. (Would vBulletin be able to size them using width or height attributes for <img /> tags?)
 
Thanks, jnj.
 
Borek said:
Report these posts please. I already did some cleaning and I am trying to react live, but - unlikely as it may sound - there are moments when I am away from my computer.

That is really kind of you Borek.

Thank you for your work on this annoyance.
 
Last edited by a moderator:
jarednjames said:
This question came up before, I believe it can't be done simply as it would require the server to hold or process each image on load for sizing.

AFAICT this problem does not require any server side solutions. It could be solved with very simple JavaScript reading the http://www.w3schools.com/tags/att_img_width.asp" of images in new posts:
<script language='JavaScript'>
function getImgSize(imgSrc)
{
var newImg = new Image();
newImg.src = imgSrc;
var height = newImg.height;
var width = newImg.width;
alert ('The image size is '+width+'x'+height);
}
</script>


Then there are alternate solutions how to handle this info, at new posting:

  1. You decide that images wider than xxx pixels are not allowed, and inform the user (to rescale).
  2. You decide to allow all images, but you let the browser handle the 'scaling'.

In case of alt 2, there shouldn’t be a problem to calculate proportional 'scaling' and add the new allowed width to the <img> tag. If we take the monstrous (:smile:) image above, this would happen:

  • Original width & height = 8219 x 600
  • JavaScript decides this is too wide, max width allowed = 800 px (or other)
  • Scale ratio is 10.27375 and the new allowed size will be = 800 x 58
  • Finally we add this new size in the <img> tag
<img src="http://www.bpp.com.pl/IMG/panorama_z_dachu.jpg" border="0" alt="" width="800" height="58" />


(In current solution on PF width & height is not set in the <img> tag)

The drawback with the second solution is that the scaling is not "real", but temporary done by the browser, on the run. This could have the peculiar effect that pictures that looks fairly small, could take some time to load, and this could possible 'confuse' the user. This solution will also put some workload on the client, but this should be negligible on modern processors.

Problem gone! It’s just up to Greg and the staff to choose solution! :smile:

(Naturally, if one utilizes ASP or PHP, there’s more 'flexibility')


EDIT:
Here’s a descriptive demo on what happens (and as you see, no one get server access... :wink:), just change value for width & height and click the button:

http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_img_height
 
Last edited by a moderator:
Its also possible to put images inside a <div style='width:100%;overflow;hidden;'>IMG HERE</div>. Then the image doesn't get resized, but the part that is too big isn't shown.
 
  • #10
pftest said:
Its also possible to put images inside a <div style='width:100%;overflow;hidden;'>IMG HERE</div>. Then the image doesn't get resized, but the part that is too big isn't shown.

Yes could be a solution, but are you sure overflow works on all (older) browsers? And what happens inside a <table width='100%' ... > as used on PF?

What is neat with JavaScript is that you can extend the functionality to include a user dialog (on new post) and/or automatic linking to original image, for example:

14j4wo4.jpg

(This image has been resized, the original can be found http://www.bpp.com.pl/IMG/panorama_z_dachu.jpg" .)

I have to add that this solution will not put workload on the PF server. All large images are loaded from an external source, as above.
 
Last edited by a moderator:
  • #12
To all,

With the exception of the suggestions for resizing presented in this thread, I don't use it, but how does Face (Plant) Book do it ? It seems to work nicely for them ?

Rhody... :redface:
 
  • #13
I think Facebook uses server-side resizing. It's easy when they host the images themselves. That could be done for attachments on PF, but not for tags.

Anyway, I know there have been threads on this topic in the past - I think I remember suggesting a pure CSS solution one time. Given that the overlords (admins :-P) haven't implemented it, I'm sure they have their reasons, whether it's a matter of being busy or whatever.
 

Similar threads

Replies
3
Views
1K
Replies
4
Views
2K
Replies
5
Views
2K
Replies
15
Views
3K
Replies
26
Views
3K
Replies
22
Views
4K
Back
Top