TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

Members
Stats
  • Total Posts: 196,004
  • Total Topics: 21,330
  • Online today: 135
  • Online ever: 8,223 (February 19, 2025, 04:35:35 AM)
Users Online
  • Users: 0
  • Guests: 112
  • Total: 112

Auto resize images on portal?

Started by Swifty550, March 14, 2012, 06:07:01 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Swifty550

Link to my site: http://localhost
SMF version: SMF ver. 2.0.2
TP version: TP ver. Latest
Default Forum Language: English
Theme name and version: Default Cruve
Browser Name and Version: Firefox Latest
Mods installed: Highslide
Related Error messages: N/A


Is there a way to automatically resize images when I promote a post from the forum - bit like PortaMX/SimplePortal?


IchBin

I'm not aware of any portal re-sizing images like that. It would required quite a bit of resources and code to do such a thing. Not something I really want to worry about at this time.

Swifty550

Simple Portal lets you - Enables resizing images in articles and board news to 300x300px, to prevent possible overflows.




IchBin

Does it actually re-size the image? Or does it just add a width/height to the image tag?

Swifty550

Quote from: IchBinâ,,¢ on March 14, 2012, 09:50:09 PM
Does it actually re-size the image? Or does it just add a width/height to the image tag?

Sorry, I confused it. It just adds the width/height to the image tag.

ZarPrime

Swifty550,

Are you aware that there is a setting in your Admin area to set the maximum vertical and horizontal size of images in posts?  Those settings are located in Admin --> Features and Options --> Layout --> Max width of posted pictures (0 = disable) & Admin --> Features and Options --> Layout --> Max height of posted pictures (0 = disable)

I just tested this with settings of 600 pixels and 300 pixels.  If you are using the TinyPortal option for "Selected topics + articles" (Promote to FrontPage) for "What to display on frontpage:", the sizes can be set by you as the Admin of your site but you can't adjust these sizes dynamically.  They have to be set and then any future images posted to a topic that is promoted to the FrontPage, will use those maximum sizes (see test image below).

Is this what you are trying to do?


ZarPrime

Swifty550

Quote from: ZarPrime on March 14, 2012, 10:12:40 PM
Swifty550,

Are you aware that there is a setting in your Admin area to set the maximum vertical and horizontal size of images in posts?  Those settings are located in Admin --> Features and Options --> Layout --> Max width of posted pictures (0 = disable) & Admin --> Features and Options --> Layout --> Max height of posted pictures (0 = disable)

I just tested this with settings of 600 pixels and 300 pixels.  If you are using the TinyPortal option for "Selected topics + articles" (Promote to FrontPage) for "What to display on frontpage:", the sizes can be set by you as the Admin of your site but you can't adjust these sizes dynamically.  They have to be set and then any future images posted to a topic that is promoted to the FrontPage, will use those maximum sizes (see test image below).

Is this what you are trying to do?


ZarPrime

Hi ZarPrime, thanks for your response.

I'm afraid that isn't what I'm trying to do. Let me try and explain clearer...

Currently I have Highslide installed and set the maximum width to be 600px via Admin --> Features and Options --> Layout. This works perfect as it should.

Now; as you've shown - TP will use that setting on the front page. 600px on the front page and on the forum post.

With Simple Portal, regardless of the max width I set in the layout option - any image on the front page will be re-scaled via width/height of 300px. So now the front page images are 300px wide but the forum post has the standard 600px wide.

Can this be done with TP considering I prefer this portal due to the articles/features it provides.

Added an image to show you what I mean.

Top of the image is the post, bottom is the front page.

ZarPrime

Well, I have to admit that I'm not really well versed with all the options in SimplePortal, and especially with PortaMX.  So, are you saying that there is a setting in SimplePortal that will allow you to set images on the SimplePortal FrontPage to be a different size than the setting that is used in a post in the Forum?  If that's the case, I really don't know of a way to do this, other than setting the sizes to be the same on both as I explained above.  Maybe one of the other Team Members here knows a little more about how to do something like that but I expect that it's as Ichbin mentioned, the sizes are controlled by SMF.

ZarPrime

Swifty550

From looking, they use a portal.js file with this code?

function sp_image_resize()
{
var possible_images = document.getElementsByTagName("img");
for (var i = 0; i < possible_images.length; i++)
{
if (possible_images[i].className != (portal_smf_version == 1.1 ? "sp_article" : "bbc_img sp_article"))
continue;

var temp_image = new Image();
temp_image.src = possible_images[i].src;

if (temp_image.width > 300)
{
possible_images[i].height = (300 * temp_image.height) / temp_image.width;
possible_images[i].width = 300;
}
else
{
possible_images[i].width = temp_image.width;
possible_images[i].height = temp_image.height;
}
}

if (typeof(window_oldSPImageOnload) != "undefined" && window_oldSPImageOnload)
{
window_oldSPImageOnload();
window_oldSPImageOnload = null;
}
}


It seems when on the front page it adds a temporary size of 300x300. Would be good if you guys could take a loot please. :)

lurkalot

Quote from: ZarPrime on March 14, 2012, 11:22:52 PM

Maybe one of the other Team Members here knows a little more about how to do something like that but I expect that it's as Ichbin mentioned, the sizes are controlled by SMF.


Zar & Swifty550, you won't be surprised to hear, that I don't have a clue either.  :D  But in all honesty it's a great idea.   

One of the reasons I hardly ever use the promote to front page option for topics.  As my site is based around photography, a lot of the posts have large photos in them.  I doubt IchBin will add this as a feature now we're so near to going final.  But I'd also be very interested in a workaround for this problem.  Might also make a great feature for TIchyPortal MK2.

This website is proudly hosted on Crocweb Cloud Website Hosting.