thesaint wrote:

I want only the view option like your older version (uploadimg_view.php), but with delete. Don't know how to modify this Koos. So if you can do it 4 me smile

No problem. Do you want the list of files to be display like in v1.1.1? Or are you fine with the way it is displayed in v1.3.0, like in this screenshot: http://www.punres.org/files/projects/pr … 20View.png

nickfzx wrote:

no which thread should I use.  This thread or the ones on punres?

Oh, anyone you like - I will be checking both.

nickfzx wrote:

In general which board should I use for support for this plugin?

Which board? Do you mean which version?

thesaint wrote:

i already use a older version, so users can list there own uploaded pictures, works fine. Only one thing, they cannot delete. Is it simpel to solve that?

Why are you using an older version? I have made a number of important fixes since the older versions. Also: v1.3.0 now has delete functionality. It is actually very simple to modify if you want to disable/remove the gallery view.

thesaint wrote:

@Koos
Is it possible to just have a simpel list of all the pictures with the code (text only).

It is already possible to view your uploads in a list format. Just click on the 'View as list' link at the bottom of the gallery page. One can then alternate between the list and gallery view. Or do you want to disable the gallery view and only have the list view?

Bjorn wrote:

Downloaded new version. Still blank screen after send button....

Hi Bjorn - I have sent you an email. It is some instructions on how to determine the cause of the blank screen you are getting.

Update:
Just for the record: I have discovered what caused the blank screen with Bjorn. It is the $HTTP_POST_FILES array that was used in parts of the script. In the latest versions of PHP the $_FILES array is now being favoured - instead of $HTTP_POST_FILES. In some PHP configurations the $HTTP_POST_FILES array may not be available. An advantage of using $_FILES is the fact that it is a superglobal.

I have subsequently updated version 1.3.0 and replaced all $HTTP_POST_FILES with $_FILES.

New release available - v1.3.0. Have added quite a few new features with this release. Almost everything can be configured to suite your needs.

By popular demand I added delete functionality. Also now possible to resize uploaded images on upload.

See the changelog for the rest of the new features in this release.

onecut wrote:

It seems to works perfect, thx lot''

Happy you got it to work.


Bjorn wrote:

The results page is completely empty, with no error message.

It seems the problem is on line 188 of uploadimg.php. Try the following (for v1.2.2):

#
#---------[ 1. OPEN ]-----------------------------------------------------------
#

uploadimg.php

#
#---------[ 2. FIND (line: 188) ]-----------------------------------------------
#


if (isset($_GET['subpage']) && $_GET['subpage'] == 'upload' && $HTTP_POST_FILES['imagefile']['name'] != null) {   // Uploading/Resizing Script


#
#---------[ 3. REPLACE WITH ]--------------------------------------------------
#

if ((isset($_GET['subpage'])) && ($HTTP_POST_FILES['imagefile']['name'] != null)) {   // Uploading/Resizing Script


#
#---------[ 4. IF THAT DIDN'T WORK, REPLACE WITH ]--------------------------------------------------
#


if ((isset($_GET['subpage'])) && (!empty($HTTP_POST_FILES['imagefile']['name']))) {   // Uploading/Resizing Script



#
#---------[ 5. IF THAT DIDN'T WORK, REPLACE WITH ]--------------------------------------------------
#

if ((isset($_GET['subpage'])) && (isset($HTTP_POST_FILES))) {   // Uploading/Resizing Script
Bjorn wrote:

I don't get any Error Messages, it just goes from 'Select Image to Upload' screen And when I press 'Send' (skicka in Sweden) it goes to the 'Result' screen but there is nothing and no images in uploads or uploads/thumbs.

Is the results page completely empty? Can you see a box displayed which says:

Kopiera och klistra in följande i meddelandefältet när du skriver ditt inlägg (Swedish)
or
Copy and Paste the following into the message box of your post (English)

Can you also get me the following values in your php.ini file:

*file_uploads
*max_execution_time
*memory_limit
*post_max_size
*upload_max_filesize
*upload_tmp_dir

Bjorn wrote:

Also if I try the statistics i get following error:
Warning: Invalid argument supplied for foreach() in d:\customers\kullberg.nu\wwwroot\forum\uploadimg_stats.php on line 533
Warning: Invalid argument supplied for foreach() in d:\customers\kullberg.nu\wwwroot\forum\uploadimg_stats.php on line 589

Thanks for letting me know. This happens because the uploads folder is still empty (nothing has been uploaded yet), so the "contents" arrays are empty. To fix this these arrays must be declared. I will include this fix in the next version (v1.3.0).

#
#---------[ 1. OPEN ]-----------------------------------------------------------
#

uploadimg_stats.php

#
#---------[ 2. FIND (line: 75) ]-----------------------------------------------
#

$file_prefix = $pun_user['id']."_"; // the pun user id is used as the prefix for all uploaded files
$prefix_length = strlen($file_prefix);

#
#---------[ 3. AFTER, ADD ]--------------------------------------------------
#

$nuwearray = array();
$tmp_array = array();
Bjorn wrote:

Can it be that nothin is uploaded?

My Server where the forum is:
gd

GD Support  enabled 
GD Version  bundled (2.0.28 compatible) 
FreeType Support  enabled 
FreeType Linkage  with freetype 
FreeType Version  2.1.9 
T1Lib Support  enabled 
GIF Read Support  enabled 
GIF Create Support  enabled 
JPG Support  enabled 
PNG Support  enabled 
WBMP Support  enabled 
XBM Support  enabled 

/Björn

Can you also please get the following info for me (using  <? phpinfo() ?>)

At the very top of the page:
*PHP Version

Under Configuration - PHP Core:
(on or off?)
*safe_mode
*safe_mode_gid

*magic_quotes_gpc
*magic_quotes_runtime
*magic_quotes_sybase

At the bottom of the page:
Under Environment:
*TERM

Did you remember to CHMOD the uploads and uploads/thumbs directories to 777?

What happens right after trying to upload an image? Do you get an error message?


onecut wrote:

thx a lot for quick answer.

It seems to works but i get a

"Warning: Division by zero in /home/www/xxxxxxxxxxxxx/web/forums/uploadimg.php on line 250"

message in the same time that i get the links (who are working).

thx, cu, onecut

Did you change anything in the uploadimg_config.php file?

It seems the problem is with the following two lines:

         $zoomw = $currwidth/$twidth;
         $zoomh = $currheight/$theight;

if $twidth and $theight is not set in the uploadimg_config.php file - you will get a 'Division by zero' error.

try replacing the above with

         $zoomw = $currwidth/150;
         $zoomh = $currheight/150;

to see if it fixes the problem.

onecut wrote:

Hi koos and thx for your project! I was waiting a thing like that a LOT!

I have just a small problem with image with res like :600*900.

When width is > height i got some probleme:

I discovered earlier this week that there is a small bug with the script calculating the thumbnail resize width and height.  Try the following to see if it will fix your problem. I will include this fix in the next version (v1.3.0).

#
#---------[ 1. OPEN ]-----------------------------------------------------------
#

uploadimg.php

#
#---------[ 2. FIND (line: 246) ]-----------------------------------------------
#

      $currwidth = imagesx($simg);   // Current Image Width
      $currheight = imagesy($simg);   // Current Image Height
      if ($currheight > $currwidth) {   // If Height Is Greater Than Width
         $zoom = $twidth / $currheight;   // Length Ratio For Width
         $newheight = $theight;   // Height Is Equal To Max Height
         $newwidth = $currwidth * $zoom;   // Creates The New Width
      } else {    // Otherwise, Assume Width Is Greater Than Height (Will Produce Same Result If Width Is Equal To Height)
        $zoom = $twidth / $currwidth;   // Length Ratio For Height
        $newwidth = $twidth;   // Width Is Equal To Max Width
        $newheight = $currheight * $zoom;   // Creates The New Height
      }

#
#---------[ 3. REPLACE WITH ]--------------------------------------------------
#

      $currwidth = imagesx($simg);   // Current Image Width
      $currheight = imagesy($simg);   // Current Image Height
      
         $zoomw = $currwidth/$twidth;
         $zoomh = $currheight/$theight;

            if ($zoomw > $zoomh) {
              $zoom = $zoomw;
                      }

            else {
              $zoom = $zoomh;
                }

           $newwidth = $currwidth/$zoom;
           $newheight = $currheight/$zoom;
axa wrote:

Update works just fine - although what am I missing here ? - I left the uploadimg_config.php untouched - yet still, users can upload files exceeding the 200 kb maximum.

You might have a different version of php on your web server. Try the following:

On line 223 of uploadimg.php

replace

if (($size_limit == "yes") && ($limit_sizef < $imagefile_size)) { // file size must be less than $limit_sizef ****

with

if (($size_limit == "yes") && ($limit_sizef < $_FILES['imagefile']['size'])) { // file size must be less than $limit_sizef ****

Thanks for letting me know about this. It's actually better to use $_FILES['imagefile']['size']) - I have updated the v1.2.2 download file.

axa wrote:

Also - when logged in a a normal member with permission to upload, I tried to upload a 1.2 meg jpg to test the limits, and was prompted to download the file uploadimg.php ???!!!

I think this is a PHP memory issue. Read what I said about this here: http://punbb.org/forums/viewtopic.php?pid=90284#p90284

But the fact that you were prompted to download the file uploadimg.php is very strange - I can not explain than.

I have made another update. Version 1.2.2 is now available. I had to make some important fixes and changes. Here is what has changed since v1.2.1:

* totals now shown in the 'upload statistics' table
* added language support
* fixed: upload not saved if thumbnail can not be created
* fixed: PNG Image file interpretation problem in IE (ie6 sends image/x-png instead of image/png)
* other minor changes

A big thanks to FSX (Dutch), Super_baloo8 (French), lie2815 (German) and Thor (Swedish) for their translations.

beipink wrote:
Koos wrote:
beipink wrote:

A nice, very nice feature would be to put text next to the image, like in the magazines. To get that is quite easy, an example here below

Thanks for the idea - but it is already possible to to this. Just type your text right after inserting the code of the image - the text will then display next to the image.

How??

Like this:

[url=http://www.mydomain.com/forum/uploads/2_0002.JPG][img]http://www.mydomain.com/forum/uploads/thumbs/2_0002.JPG[/img][/url]Koos

example:
http://i168.photobucket.com/albums/u200 … etext1.png

The secret is not to hit the enter button. Use spacebar if you want to leave a gap between the image and text.
example:
http://i168.photobucket.com/albums/u200 … etext2.png

But I think you meant how to insert a paragraph next to an image. I don't think this is possible without editing the parser.

I tried your suggestion of editing the include/parser.php file - but it did not work for me.

reviewum.com wrote:

Looks excellent!  I've already added it to one of my forums and the feedback has been great.  Any chance there will be an option for resizing on upload?  big_smile

BTW, I still like the fact that this "mod" is independent of any DB / File modifications.  Simple, clean, easy to add and easy to remove.  This is how I dream that the extentions in 1.3 will work.

Thanks - I am still looking into including the resizing option. Just got to figure out how to deal with the pixel dimension limit. When uploading large pixel dimension images you get a blank screen (symptom of memory max-out).

For example: resizing a low quality  1613x1210 (70KB) image you get a blank screen.

On the contrary: resizing a high quality 1000x800 (1137KB) image works perfectly.

nickfzx wrote:

In the gallery view there should be a "get code" button under each thumbnail...better still a little auto-copy-to-clipboard box like photobucket do.

I agree. I made an update (v1.2.1) where the BBCode is generated below each thumbnail in the gallery- like Photobucket/ImageShack.

I have finally completed version 1.2. With this version I have made quite a number of improvements. See the changelog for more info. Thanks to all for their suggestions.

I have nearly finished my next version of this mod (v1.20). Will be available within a day or two.

reviewum.com wrote:

The main thing I'd like to see added is the ability to resize the original image on upload so members can just resize to meet the max limit on the spot.

The original script I made was able to do this (before making it available as a MOD) - but it only resized to a given pixel width, not size. Will see what I can do to give an option of resizing to meet the max limit. (good idea)


nickfzx wrote:

images show up as urls not images if there is a space in the image file name...which is why I won't be using this just yet.

I will correct this in the next version - all spaces will be replaced by _ (underscore)

nickfzx wrote:

Also is there an easy way to switch from not using thumbnails...I would prefer this I think.

With the next version's gallery view one will be able to get the url of the original image easily. This can then be used if you want to display the original image without the thumbnail.

nickfzx wrote:

Would be really cool if this mod could make use of Ajax...so you could start writing a message and when you want an image then you just click insert image the image is uploaded and the correct url with IMG tags is stuck strait into your post field without even refreshing the page.

I don't know anything about Ajax - will look into this.

Like I said earlier: my plan was to add a new usergroup (e.g. Uploader) and then to promote members to the rank of 'Uploader'. Only 'Uploaders' will have permission to upload images.

But won't it be better to allow all members to upload images- and then create a usergroup 'Banned Uploaders'? Then all members can upload - and you only ban those users that misuse the system from uploading.

Any suggestions?

beipink wrote:

A nice, very nice feature would be to put text next to the image, like in the magazines. To get that is quite easy, an example here below

Thanks for the idea - but it is already possible to to this. Just type your text right after inserting the code of the image - the text will then display next to the image.

Anyway, with my "MOD" my aim is to leave all punbb files and the database unaffected - so I will not require you to make any modifications to existing punbb pages.

-J- wrote:

A minimum number of posts as a first security would be good, indeed.

The idea of the admin page is very good too smile


Can you make a combination of these two options?

On second thought, minimum post idea not very practical - easy to get past - just post the number of blank posts required and then delete them. (your number of posts are not decremented in punbb when deleting posts)

A better idea is maybe to add a new usergroup (e.g. Uploader) and then to promote members to the rank of 'Uploader'. Only 'Uploaders' will have permission to upload images.

axa wrote:

A positively awesome little add-on. I wish all mods were this easy.
Just dawned on me - there is nothing stopping anyone from registering on one's forum, and uploading pics to leech bandwidth, right ?

You're right. Have you got any suggestions? Maybe only allow an user to upload images after he has posted a certain number of posts - or maybe an admin page where you can give users permission to upload (users will then have to request permission for uploading). This admin page should be able to tell you how much uploads (in MB) each user has made and also allow you to browse his gallery (only for admin) etc. Might also be a good idea to hotlink protect the images on your website to save bandwidth.

What do you think?

I am also currently working on a feature which will allow you to view all your uploaded images as a gallery (like with flickr).

##
##        Mod title:  Automatic Image Upload with Thumbnails
##
##      Mod version:  1.3.5
##   Works on PunBB:  1.2.*
##     Release date:  2008-06-15
##           Author:  Koos (pampoen10@yahoo.com)
##
##      Description:  This tool allows users to upload images and automatically
##                    creates thumbnails for them which can then be displayed
##                    in your forum posts. Clicking the thumbnail shows the
##                    original image. By only displaying thumbnails pages load
##                    quicker. This is not really a "MOD" since no punbb files
##                    have to be modified and the database is not affected.
##                    This makes for very easy installation and removal if
##                    needed. Also no changes are necessary when upgrading 
##                    your punbb forum.
##
##   Affected files:  none
##                                     
##       Affects DB:  no
## 
##            Notes:  Requires the GD library on your Web server. Script can
##                    upload JPEG, PNG AND GIF images.
##
##       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.
##
################################################################################
## CHANGELOG:
## 1.3.5 : made the necessary changes so that sorting will work in PHP5
##         fixed a serious vulnerability
##         other minor changes
## 1.3.4 : rewrote the 'uploadimg.php' page
##         fixed a vulnerability
##         all pages now valid XHTML 1.0 Strict
##         stats totals now also include thumb size
## 1.3.3 : fixed thumbnail creation bug
##         - previously, when width<twidth and height>theight: no resize
##         removed dimensions column in list view
##         other minor fixes
## 1.3.2 : added statement allocating all necessary memory for image processing
##         transliterates filenames with umlauts, accents, ligatures and runes 
##         added dimensions column to list of uploaded images
##         fixed bug resulting in interrupted uploads being saved
##         other minor changes
## 1.3.1 : much improved thumbnail and image resize quality
##         improved 'resize image' function
##         more efficient use of PHP memory - can now resize larger images
##         removed user id from statistics table
##         other minor changes
## 1.3.0 : strips all non-alphanumeric characters in filename
##         fixed image resize aspect ratio problem
##         added delete functionality
##         added option to resize images on upload
##         added option to view image URL link below thumbnail in the gallery
##         thumbnail now shown on the results page after upload
##         other minor fixes and improvements
## 1.2.2 : totals now shown in the 'upload statistics' table
##         added language support
##         fixed: upload not saved if thumbnail can not be created
##         fixed: PNG Image file interpretation problem in IE
##         - (ie6 sends image/x-png instead of image/png)
##         other minor changes
## 1.2.1 : BBCode now generated below each thumbnail in the gallery
##         - like Photobucket/ImageShack
## 1.2.0 : changed layout to conform more closely to the punbb standard
##         added an 'upload statistics' feature
##         added flickr style gallery feature - with latest upload displayed first
##         added full permission control
##         all spaces in filenames of uploaded images now replaced with _ (underscore)
##         dates in upload list now displayed as in the rest of your forum
##         other minor improvements
## 1.1.1 : fixed compatibility problem with Internet Explorer
##         some other minor fixes
## 1.1.0 : added support for PNG and GIF files
##         simplified  configuration (don't have to specify absolutepath or forumurl)
## 1.0   : initial release 
################################################################################

I have recently completed an 'upload with automatic thumbnail creation' tool. The great thing about this "MOD" is that you don't have to make any changes to your punbb files or the database.

Features:

* Extremely easy to install and remove
* Can view a list and gallery of all your uploaded images
* Can not replace a file with same filename
* Can create thumbnails of JPEG, PNG and GIF files (depending on your GD version)
* Can specify maximum file size to upload
* Can view upload statistics of users who have uploaded images

How it works:

1. You select an image file to upload e.g. image.jpg
2. The image is uploaded with your pun user id used as the prefix e.g. 12_image.jpg - this is to differentiate your uploads from the uploads of other users.
3. Thumbnail is created in the thumbnails directory
4. You are supplied with the code which you must copy and paste into your post. This allows the thumbnail of your uploaded image to be displayed in your post. Clicking the thumbnail shows the original image.

Note:

The easiest way to see whether the GD library has been installed on your Web server and which file types it supports is to create a small file (e.g. test.php) containing:

        <?php phpinfo() ?>

    and look at it using a web browser. There you will also be able to see what your PHP memory limit is (see the memory_limit parameter). It is recommended that this is at least 16MB for proper thumbnail creation operation. Ask your system administrator to raise it for you. With 16MB of PHP memory you will be able to create thumbnails of images of up to about 2000x1500 pixels in size. Uploading larger images you get a blank screen (symptom of memory max-out).

Update:
Added statement in v1.3.2 for allocating all necessary memory for image processing. On some servers this will allow you to upload and resize any size image.

Download from punres.org