Forum Software: Resize Huge Images to Improve Post Readability

  • Thread starter turbo
  • Start date
In summary: It is 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?)I don't know if that is possible, but I am sure that it can be done.
  • #1
turbo
Gold Member
3,165
56
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
  • #2
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
 
  • #3
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.
 
  • #4
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?)
 
  • #5
Thanks, jnj.
 
  • #6
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.
 
  • #8
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"[/COLOR] 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:
  • #9
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.
 

1. How does resizing images improve post readability?

Resizing images can improve post readability by making the images more proportional and fitting to the layout of the forum. This can prevent images from appearing too large or too small, which can distract readers and disrupt the flow of the post.

2. What are the benefits of using forum software to resize images?

Using forum software to resize images can save time and effort for users, as the software can automatically adjust the size of images to fit the forum's layout. This can also improve the overall aesthetics of the forum and make it more user-friendly.

3. Can users still view the full-sized image after it has been resized?

Yes, users can still view the full-sized image by clicking on the resized image. Forum software often has a feature that allows users to view the original image in a new tab or window.

4. Is there a limit to the size of images that can be resized?

This depends on the specific forum software being used. Some software may have a set limit for resizing images, while others may allow for larger images to be resized. It is important to check the software's capabilities before attempting to resize large images.

5. Can forum software also compress images to improve post readability?

Yes, some forum software may have the capability to not only resize images, but also compress them. This can help reduce the file size of large images, making them load faster and improving the overall readability of the post.

Similar threads

  • Feedback and Announcements
Replies
3
Views
1K
  • Feedback and Announcements
Replies
4
Views
2K
  • Feedback and Announcements
Replies
5
Views
2K
  • Feedback and Announcements
Replies
7
Views
2K
  • Astronomy and Astrophysics
2
Replies
43
Views
10K
  • Sci-Fi Writing and World Building
Replies
22
Views
2K
  • Feedback and Announcements
Replies
2
Views
4K
  • Feedback and Announcements
Replies
26
Views
3K
  • Feedback and Announcements
Replies
0
Views
94K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
12
Views
1K
Back
Top