News:

Wondering if this will always be free?  See why free is better.

Main Menu

existing inline images need to be resized for display.

Started by Ruben Rocha, December 12, 2017, 05:11:36 PM

Previous topic - Next topic

Ruben Rocha

Okay I imported ubb classic to smf 2.0.13.
I can't go to the current version till the server is upgraded.
My dilemma is they all imported as  <img sr= "image file.jpg"width"XXX" height"XXX" alt=" XXX" />
I have fixed most all of them in the database to [img] image file.jpg [/img].

But some images display as a huge display size

I have set the inline image size in the smf control panel to like 640.And ran all the maintenance routines but they don't resize unless I manually pick one of 2 million posts and just open and close the topic and it will resize the image.
Is there a way to fix this on existing posts with a routine?
Did I say 2 million? Yes.

Everything I have read on converting states only net new posts are re-sized based on the setting in the smf control panel.

-Rock Lee-

It's too large a quantity, I do not know how good it is ... but it's not proven nCode Image Resizer It can be an easy route to reach what you want


Regards!
¡Regresando como cual Fenix! ~ Bomber Code
Ayudas - Aportes - Tutoriales - Y mucho mas!!!

drewactual

do it with css...

the idea is to set a maximum width in a fixed absolute size in the img tag, but only for the posts display, right?

go to your theme's index.css and add this:



.post .inner img{
    max-width: 640px !important;  /*or what width you want to use*/
    height: auto; /*this keeps the proportion of the image in check*/
}



the above css assumes your posts container (divs) are the same as a 'out of the box' SMF, and haven't been modified.

Once you've done this, hold shift hit refresh (or f5) and the images, no matter when they were posted, should 'render' a max width of 640px (or whatever width you choose)- it DOES NOT change the actual size of the image, but it certainly controls the size rendered to the user... 

Ruben Rocha

I think at this time CSS is my best option.
My desire was to allow the cp to determine the size for ease of use in lieu of editing the code due to future upgrades overwriting the mod. but css  at this point is probably my best choice.
Also if I decide to change the width to say 800 it would just be a change in the cp, instead of remembering how I changed it before.

Thank you.

Ruben Rocha


Gwenwyfar

The resize function in the admin area doesn't work very well, it is better to use css. You can add that code anywhere, but when in doubt you can add css at the end of the file to be sure :)
"It is impossible to communicate with one that does not wish to communicate"


Ruben Rocha

This works for posts to view,
But the css tag is not recognized for the recent posts link,they show full size. Is there another css tag needed for recent posts?

butch2k

Try this

.post .inner img,.core_posts .list_posts img{
    max-width: 640px !important;  /*or what width you want to use*/
    height: auto; /*this keeps the proportion of the image in check*/
}

Ruben Rocha

should that be in addition to the first css tag or a replacement?


Ruben Rocha

Quote from: butch2k on February 16, 2018, 04:13:15 PM
Try this

.post .inner img,.core_posts .list_posts img{
    max-width: 640px !important;  /*or what width you want to use*/
    height: auto; /*this keeps the proportion of the image in check*/
}

This did not apper to work on recent topics.
What I ended up doing is editing
bbc_img with size parameters
that appears to work.

Advertisement: