Home N-13 News Forums Help Search
RegisterForgot password?
How to add image to post necklacesdiscou
Known bugs - 4.0.3 necklacesdiscou

Latest N-13 News 4.0.3

What is N-13 News?
Where can I get help?
Known bugs

Forums How To Automatic resizing images
1 2
Chris
Posted on 15 Oct 2009, 04:20:27

Access: Admin
Total Posts: 1395
Joined: 2006-05-19

With 3.3 you can now have images that are larger than the demensions you specify automatically be resized. This way you no longer need to manually resize your images first then upload them. Now you can upload the full size image and have the system shrink it down for you without affecting the original image.

To do this you just need to specify the max height/width of the images, then any images larger than these demensions will automatically be resized.

Code:
<?php
$image_maxwidth 
= '400'; #400pixels width
$image_maxheight = '200'; #200pixels height

include 'news/index.php';
?>


Images that are resized will keep their aspect ratio so they don't looked streached. You can specify maxheight or maxwidth, you don't need to specify both. Images that are resized will be made clickable, once clicked will open the fullsize image.
#951
Last edited by Chris at 2009-12-26 15:11:02 Reason:
Damirk
Posted on 10 Nov 2009, 14:24:14

Access: Member
Total Posts: 3
Joined: 2009-11-10

Mine wont resize :new_angry:
Code:
<?php 
<?php 
            $image_maxheight 
= '50';
            
$template = 'Index';
            
            include 
'news/index.php';
            
?> 
?>


What am I doing wrong?
I gave 3.3 installed, everything else works fine, except this, which I need the most :)
#1158
Chris
Posted on 10 Nov 2009, 17:17:30

Access: Admin
Total Posts: 1395
Joined: 2006-05-19

Can you try specifying both the max height and width to see if the image then gets resized. Also how are you inserting the image? selecting one that you've uploaded then inserting the bbcode or are you using html?
#1159
Damirk
Posted on 11 Nov 2009, 10:36:53

Access: Member
Total Posts: 3
Joined: 2009-11-10

I am trying to edit {story} formatting so I removed images now.
I had html for images at one time, not sure if it was when I tried to resize them.
I'll do it again as soon as I find out how to shorten the width of the {story}
#1160
Frohlich
Posted on 19 Jan 2010, 09:47:52

Access: Member
Total Posts: 9
Joined: 2010-01-04

It works fine for me.

Just a question. When the picture/image is posted in the news, there is made a link path to the actual image, so if you click on the picture i will open.

How can I delete this link?

- Also. I use MAC, when I upload a new image in Image Upload the adminsystem goes balistic and the menu disapears, but the image is uploaded.

Just on mac or a general bug?

Thanks,

Morten
#1634
Chris
Posted on 19 Jan 2010, 13:10:21

Access: Admin
Total Posts: 1395
Joined: 2006-05-19

I imagine it's more of a bug with a specific browser, are you using Safari? once I find out the browser I'll try replicate then create a fix for it.

And to stop the resized images being clickable, if you edit bbparser.php, around line 41~ you'll see this code

Code:
        return "<div class=\"image_container\" style=\"width: $new_width" . "px\"><a href=\"$str\"><img class=\"fullnewsimage\" alt=\"image\" src=\"" . $adminpath . "?action=options&mod=imageuploads&width=$new_width&height=$new_height&thumb=$str\" /></a><br style=\"clear: both\" /><span class=\"image_caption\">$caption</span></div>";


change that to

Code:
        return "<div class=\"image_container\" style=\"width: $new_width" . "px\"><img class=\"fullnewsimage\" alt=\"image\" src=\"" . $adminpath . "?action=options&mod=imageuploads&width=$new_width&height=$new_height&thumb=$str\" /><br style=\"clear: both\" /><span class=\"image_caption\">$caption</span></div>";


I'll make this an option you can specify in your include code in the next version so that you don't need to edit any files.
#1635
Last edited by Chris at 2010-01-19 13:16:11 Reason:
Frohlich
Posted on 26 Jan 2010, 14:09:52

Access: Member
Total Posts: 9
Joined: 2010-01-04

Works great!

Last 2 questions:

1. How can I align all my images to the right, so the text i still aligned left and filled "around the image". Understand? Can i use this in the script above? <img src="imagepath.jpg" alt="" height="375" width="250" align="right" border="0">

2. I have the php code 2 places on the same page e.g. index.php. A "main window" where I put the content and a "summary" to the right with newsupdate. When I use "short story" and click on read more in the summary it also shows the full story in the "main window". How can I avoid that.

Thaks for a super script!

Morten
#1742
Chris
Posted on 26 Jan 2010, 17:12:29

Access: Admin
Total Posts: 1395
Joined: 2006-05-19

1. The code I mentioned in my previous post, if you change it to this all images will be aligned to the right and text will be aligned to the left around the images.

Code:
        return "<div class=\"image_container\" style=\"width: $new_width" . "px\"><img style=\"float: right\" class=\"fullnewsimage\" alt=\"image\" src=\"" . $adminpath . "?action=options&mod=imageuploads&width=$new_width&height=$new_height&thumb=$str\" /><br style=\"clear: both\" /><span class=\"image_caption\">$caption</span></div>";


Or if you don't want to edit the code again you can add a bit of css code to your stylesheet that will make all images aligned to the right

Code:
#allbody img {
    float: right;
}


2. To stop the full story showing in the main window, Add $static = true before the include, so it'll look something like this

Code:
<?php
$static 
= true;
include 
'news/index.php';
?>
#1743
Last edited by Chris at 2010-01-26 17:14:36 Reason:
Neotomaz
Posted on 01 Feb 2010, 21:12:59

Access: Member
Total Posts: 3
Joined: 2010-02-01

Well i am new to php code.

So one silly question. Where i put

<?php
$image_maxwidth = '400'; #400pixels width
$image_maxheight = '200'; #200pixels height

include 'news/index.php';
?>

in whitch file?

Index.php or in code of my webpage?

Thanks!
#1804
Chris
Posted on 01 Feb 2010, 21:17:53

Access: Admin
Total Posts: 1395
Joined: 2006-05-19

You put that code in your own website wherever you want the news to be displayed.
#1805
1 2
Network-13.com © 2013