1 (edited by NightFalcon 2005-11-03 23:39)

Topic: Image Upload 1.2.1

##
##
##        Mod title:  Image Upload
##
##      Mod version:  1.2.1
##   Works on PunBB:  1.2.5, 1.2.6, 1.2.7, 1.2.8, 1.2.9, 1.2.10
##     Release date:  2005-11-3
##           Author:  Max Khitrov <max@mxsoft.org>
##
##      Description:  This mod allows forum users to upload images with their
##                    posts. Some of the highlights include: full permission
##                    management, automatic thumbnail generation, a per-post
##                    gallery, and no virtually no database involvement.
##
##   Affected files:  admin_forums.php
##                    viewtopic.php
##                    post.php
##                    edit.php
##                    delete.php
##                    profile.php
##                    header.php
##                    moderate.php
##                    include/functions.php
##                    lang/English/common.php
##
##       Affects DB:  Yes
##
##            Notes:  1) As always, if you find problems with this mod,
##                       please post on mxsoft.org forums or e-mail them to me
##                       so I could get them fixed as soon as possible.
##                    2) A number of people have asked me already, so just to
##                       prevent further confusion: After you install this mod,
##                       the admins are the ONLY ones who can post images.
##                       To let others upload as well, go to permissions for
##                       individual forums and set them there. Until you do
##                       that, the upload form will not show for your visitors.
##                    3) If upgrading from a previous version, see the
##                       upgrade.txt file. It's becoming a bit of a problem
##                       maintaining this in order for all the other version,
##                       so from now on, this file will only contain
##                       instructions for upgrading from the last version.
##                       If you happen to skip one, you'll have to either figure
##                       it out on your own, or go through all previous updates.
##                    4) See changelog.txt for a list of all changes.
##                    5) After you install this mod, be sure to configure it
##                       from the Administration Panel before use!
##
##       DISCLAIMER:  Please note that "mods" are not officially supported by
##                    PunBB. Installation of this modification is done at your
##                    own risk. Backup your forum database and any and all
##                    applicable files before proceeding.
##
##

Download Here

Punres.org Topic: http://www.punres.org/viewtopic.php?pid=3338

If you have any questions/comments/problems, please either e-mail them to me (if it's important) or post on http://www.mxsoft.org. I'll try to come by these forums once in a while as well, but might not do so on daily basis.

Enjoy! smile

2

Re: Image Upload 1.2.1

Ohhhh yes !!!! Very good !!! smile I try tomorrow smile Love the possibility to have several pics on a same pic smile only one thing : I'll post a hack here to call pic inside a layer (dhtml) : better and more beautiful smile

3

Re: Image Upload 1.2.1

wow.. this is cool

Re: Image Upload 1.2.1

Rod wrote:

I'll post a hack here to call pic inside a layer (dhtml) : better and more beautiful smile

I have no idea what you mean there, but I'm looking forward to it smile

Right now I'm actually working on making the whole thing look a little better, don't like the way it is right now, but since my css abilities are rather crappy it's taking me longer then I would prefer it to roll

Re: Image Upload 1.2.1

Hi guys, new version was just released. See punres.org topic for all the details smile

6

Re: Image Upload 1.2.1

So here's my request ... and I think it's possible to you to do this smile ... I'm fed up with all system galleries where you "leave" the page to see a pic. So go to http://www.sortons.net/test-nucleus.html and see at the left of the pic : 100% dom, very degradable system (if people have no JS, it links to the pics without errors).

The advantage ??? you DON'T LEAVE the post you read. Hoping this idea pleases you smile

7

Re: Image Upload 1.2.1

Hey night falcon (or anybody who is interested)

If I pay pal'd you $20 bucks, would you be willing to install this for me? I can send you all the files n' all that. I absolutely suck at this, but my forum regulars have been begging for this for a while.

If so, please contact me: fraggerock@gmail.com

Re: Image Upload 1.2.1

Rod: it's certainly possible for me to do that, but there is a problem with such approach - when dealing with large photos, or photos of variable size, it becomes very difficult to fit it with the content and still have the whole thing look good. I'll have to think about this one and the best way to implement it. I'm thinking if I have some kind of a pop-up on mouseover event using layers, or something to that sort, it might work, but I'll have to play around with it to figure out the best way. Also there's the issue of loading the images - some poor soul on 56K places his cursor over an image while viewing a thread, and there goes his bandwidth. We'll see... If I find a good way to implement this, I will.

bozer: I'd be happy to do the install for free once I get home from work. Just e-mail me the following files:
admin_forums.php
viewtopic.php
post.php
edit.php
delete.php
include/functions.php
lang/English/common.php

I'll send the modified versions back to you, but you'll still have to run the install_mod.php script, and upload the other files. wink

Re: Image Upload 1.2.1

The mod works great, but have a little problem with the back end.

When I go to admin options, and change something... no matter what I change it always tells me that I have "Invalid maximum images per post.".

I have changed what I needed to from the back end, but I still wondered if anyone else having the same problem. Or if you could point me in the direction of the possible cause.

Thanks.

Posted on Punres as well.

10 (edited by bozer 2005-09-20 19:24)

Re: Image Upload 1.2.1

Night... What's your email address? I'm making a zip file of them now.

Actually.. nvrmind. I'm emailing you through this board with a link to download a zip file with the files you mentioned.

Thanks so much!

11

Re: Image Upload 1.2.1

NightFalcon wrote:

Rod: it's certainly possible for me to do that, but there is a problem with such approach - when dealing with large photos, or photos of variable size, it becomes very difficult to fit it with the content and still have the whole thing look good. I'll have to think about this one and the best way to implement it. I'm thinking if I have some kind of a pop-up on mouseover event using layers, or something to that sort, it might work, but I'll have to play around with it to figure out the best way. Also there's the issue of loading the images - some poor soul on 56K places his cursor over an image while viewing a thread, and there goes his bandwidth. We'll see... If I find a good way to implement this, I will.

I'm ok with you of certain points ... but it would be great webmaster STOP to think 56k, stop to think Netscape 4, stop to think IE 4 ... the future is IN FRONT OF US smile not behind.

thanx to consider my view.

Re: Image Upload 1.2.1

Hello again, as StevenBullen pointed out, there was a problem with 1.0.1 release that I missed, and a new version is out to fix it. See this thread for details: http://www.punres.org/viewtopic.php?id=685

13 (edited by Rod 2005-09-20 22:33)

Re: Image Upload 1.2.1

OK I have installed it ... so smile ...

http://www.sortons.net/forum/viewtopic.php?id=5008

1. NO TABLES !!! smile it's quite simple to use instead

<div class="thumbs">
<a href="urlofthepic.php"><img src="thumb.jpg" /></a>
<a href="urlofthepic.php"><img src="thumb.jpg" /></a>
<a href="urlofthepic.php"><img src="thumb.jpg" /></a>
<a href="urlofthepic.php"><img src="thumb.jpg" /></a>
<a href="urlofthepic.php"><img src="thumb.jpg" /></a>
</div>

And play with the CSS to float or not, to crop (with css) the pic or not ... it would be great appreciated smile

2. The resize of the pic doesn't work when you click on the pic ...

3. Have the possibility to add pics inside "Quick Answer Box"

14

Re: Image Upload 1.2.1

I see where is the "bad" code smile

image_upload.php

$output[] = "\t\t\t\t\t\t\t<table cellspacing='0' cellpadding='0' border='0' style='margin-top: 15px; margin-bottom: 15px'>";

    while ($idx < $image_count) {

        $output[] = "\t\t\t\t\t\t\t\t<tr>";

        for ($col = 0; $col < $max_cols; $col++, $idx++) {
            $output[] = "\t\t\t\t\t\t\t\t\t<td align='center' valign='top' width='$cell_width%' style='border: none; padding: 0px'>";

            if ($idx < $image_count) {

                $output[] = "\t\t\t\t\t\t\t\t\t\t<table cellspacing='0' cellpadding='0' border='0' width='$cell_width%'>";
                $output[] = "\t\t\t\t\t\t\t\t\t\t\t<tr>";
                $output[] = "\t\t\t\t\t\t\t\t\t\t\t\t<td align='center' valign='middle' width='$cell_width%' height='$cell_height' style='border: none; padding: 0px'>";

                $url_name = urlencode($images[$idx]);

                if (!$edit)
                    $output[] = "\t\t\t\t\t\t\t\t\t\t\t\t\t<a href='postgallery.php?pid=$pid&filename=$url_name&tid=$tid'>";
                $output[] = "\t\t\t\t\t\t\t\t\t\t\t\t\t\t<img src='showimage.php?pid=$pid&filename=$url_name&preview=true' />";
                if (!$edit)
                    $output[] = "\t\t\t\t\t\t\t\t\t\t\t\t\t</a>";

                if ($edit) {
                    $output[] = "\t\t\t\t\t\t\t\t\t\t\t\t</td>";
                    $output[] = "\t\t\t\t\t\t\t\t\t\t\t</tr>";
                    $output[] = "\t\t\t\t\t\t\t\t\t\t\t<tr>";
                    $output[] = "\t\t\t\t\t\t\t\t\t\t\t\t<td align='center' valign='bottom' width='$cell_width%' style='border: none; padding: 0px'>";
                    $output[] = "\t\t\t\t\t\t\t\t\t\t\t\t\t<label><input type='checkbox' name='delete_image[]' value='".urlencode($images[$idx])."'> Delete</label>";
                }

                $output[] = "\t\t\t\t\t\t\t\t\t\t\t\t</td>";
                $output[] = "\t\t\t\t\t\t\t\t\t\t\t</tr>";
                $output[] = "\t\t\t\t\t\t\t\t\t\t</table>";

            } else {
                $output[] = "\t\t\t\t\t\t\t\t\t\t ";
            }

            $output[] = "\t\t\t\t\t\t\t\t\t</td>";
        }

        $output[] = "\t\t\t\t\t\t\t\t</tr>";
    }

    $output[] = "\t\t\t\t\t\t\t</table>";
    $output[] = "\t\t\t\t\t\t</fieldset>";
    $output[] = "\t\t\t\t\t\t<br />";
    $output[] = "\t\t\t\t\t</div>";

    echo implode("\n", $output);

}

15 (edited by NightFalcon 2005-09-20 23:25)

Re: Image Upload 1.2.1

Sorry, back in the day, when I had to walk 10 miles to school in 2 feet of snow uphill both ways, we used to use tables tongue

I'm personally not a fan of css - like the idea of separating formatting from the data, but the implementation seems unnecessarily chaotic. If I have time later on, I'll consider changing it to something else. For now, I don't see anything wrong with using tables.

Regarding number 2, not sure what you mean there.

Definite no for number 3 - it's supposed to be quick, and file uploads don't fit into that category wink If you want to modify it for your board, feel free to do so.

16 (edited by Rod 2005-09-20 23:28)

Re: Image Upload 1.2.1

Because with tables, the only choice you have is to insert rows * cols

or with a css structures, you don't need this smile

About Point 2 : if a pic is bigger, it's not scaled : or in the whole forum, the pic, if bigger, is scaled smile

Re: Image Upload 1.2.1

Rod wrote:

Because with tables, the only choice you have is to insert rows * cols

I don't see a problem with that... Your monitor is made up of rows and columns, but you don't seem to be complaining there wink

18

Re: Image Upload 1.2.1

NightFalcon wrote:
Rod wrote:

Because with tables, the only choice you have is to insert rows * cols

I don't see a problem with that... Your monitor is made up of rows and columns, but you don't seem to be complaining there wink

ggrrrrrrrrrr smile

the problem is the "non control" by css : I remember you TABLES are only used for TABULAR DATAS in xhtml smile or ... punBB is xhtml compliant smile

Re: Image Upload 1.2.1

Fair enough, like I said, if I have time later on to modify it and learn css along the way, I'll do so. Until then, I have rows and columns of images.

20

Re: Image Upload 1.2.1

OK smile I give you a little tutorial smile

so ... instead of <table> .... you begin by <div class="thumbs">

and instead of using <td> ... </td> you use only <a href=" "><img src=" " /></a>

</div>

As you can see ... you win in quality of code smile (no ? smile)


So in CSS ...

.thumbs a {
width : 50px; >> control of the width of your thumb
height : 50px; >> control of the height of layer
overflow : hidden; >> no scroll
float : left; >> to "simulate" a row
border : 3px solid #000; >> gadget
margin : 3px; >> gadget smile
}
.thumbs a:hover {
border : 3px solid #C23000;
}

.thumb a img {
margin-top : -15px;
margin-left : -20px;
border : 0;
}

Using this technique, I have "cropped" my pics without using GD or ImageMagick smile and it's floated ...

Result : your code is very clean and respect the "spirit" of the viewtopic.php (no tables)

smile

21

Re: Image Upload 1.2.1

NightFalcon, did you get my email? Just want to be sure

Re: Image Upload 1.2.1

Yep, sent you a reply 30 minutes ago. Let me know if you didn't get it.

23

Re: Image Upload 1.2.1

Got it! thanks.. Going to attemp the install now. Will report back with details of my victory (hopefully)

smile

24

Re: Image Upload 1.2.1

MY forums aren't working now:

http://www.fraggerock.com/forum/index.php

I am running the newest punbb, and got this message when I tried to run install_mod.php: 
You are running a version of PunBB () that this mod does not support. This mod supports PunBB versions: 1.2.6, 1.2.7

25

Re: Image Upload 1.2.1

Ok I reuploaded files, and got that fixed. Forums are now up...

However, when I go to post a new topic, I get this:

http://www.fraggerock.com/forum/post.php?fid=2

An error was encountered
Error: Unable to fetch forum info.