UBB.Dev
Posted By: Anno Beta-[6.4-6.5] Restrict Images 2.0 - 01/04/2005 4:05 PM
***~~~ Version 1.0 ~~~*** Download

***~~~ Version 2.0 ~~~*** Download

In version 2.0, if an image is to large you are redirected back to the post preview page and a red border arround the image that is too large is displayed.

Mod Name / Version: Restrict Images 2.0

Description: The mod checks the images contained within the image tags in a post for width, height, filesize and image count.

The admin can specify the maximum amount of images per post, the maximum image width, height and size.

If one of the criteria is not within the limits, an error message is displayed, example:
[]http://img148.exs.cx/img148/4148/clipboard017ys.gif[/]

Working Under: UBB.Threads 6.4-6.5

Mod Status: Beta

Any pre-requisites: none

Author(s): Anno

Date: 01/04/05

Credits:

Files Altered:
addpost.php
modifypost.php

New Files:
checkimages.php

Datebase Altered: no

Info/Instructions: Instructions within the checkimages.php file.

In order for the getimagesizes() function to work on remote files, the PHP version has to be > 4.0.5 .


Disclaimer: Please backup every file that you intend to modify.
If the modification modifies the database, it's a good idea to backup your database before doing so.

Note: If you modify your UBB.Threads code, you may be giving up your right for "official" support from Infopop.If you need official support, you'll need to restore unmodified files.


Attached File
124272-checkimages1.0.zip  (45 downloads)
Posted By: Astaran Re: Beta-[6.4-6.5] Restrict Images 1.0 - 01/04/2005 5:16 PM
Thx! This one was also on my list.
A suggestion that might be more comfortable for the users:
If an image is to large, redirect to the post preview page and display a red border arround the image that is too large.
This way they don't have to go back and they can see which one is too large.
Posted By: Anno Re: Beta-[6.4-6.5] Restrict Images 1.0 - 01/04/2005 6:31 PM
>If an image is to large, redirect to the post preview page and display a red
>border arround the image that is too large.

This is a good suggestion, I will look into this.
Posted By: Anno Re: Beta-[6.4-6.5] Restrict Images 1.0 - 01/05/2005 3:40 AM
Version 2.0 in the attachment.

Attached File
124297-RestrictImages2.0.zip  (68 downloads)
Posted By: donJulio Re: Beta-[6.4-6.5] Restrict Images 1.0 - 01/05/2005 6:39 AM
[]Anno said:
Version 2.0 in the attachment. [/]

And what's in version 2.0?
Posted By: Anno Re: Beta-[6.4-6.5] Restrict Images 1.0 - 01/05/2005 11:24 AM
>If an image is to large, redirect to the post preview page and display a red
>border arround the image that is too large.
Posted By: donJulio Re: Beta-[6.4-6.5] Restrict Images 1.0 - 01/10/2005 9:12 PM
I have a question, Anno. I am having my site redone, and I am going to use this mod so that the new layout, which includes graphics on the right side of the page, doesn't get stretched. The maximum allowable width would be about 740 pixels.

My question is, what if I have a user puts two, let's say 500 pixel-wide, images in a post without using a linebreak in between. Will this mod split them up, putting them on different lines, so that they don't break up the layout?
Posted By: Anno Re: Beta-[6.4-6.5] Restrict Images 1.0 - 01/11/2005 1:05 AM
The images are put in the next line automatically by the browser.
The following images are all placed in one line.


[]http://artists.iuma.com/IUMA/Bands/Government_Chicken_Boy/images/lg-30850.jpg[/][]http://artists.iuma.com/IUMA/Bands/Government_Chicken_Boy/images/lg-30850.jpg[/][]http://artists.iuma.com/IUMA/Bands/Government_Chicken_Boy/images/lg-30850.jpg[/]
Posted By: donJulio Re: Beta-[6.4-6.5] Restrict Images 1.0 - 01/11/2005 8:20 AM
[]Anno said:
The images are put in the next line automatically by the browser.
The following images are all placed in one line.
[/]

Is that a function of this mod, or the browser? Because the last thing I want is images stetching and breaking my new layout? However it is the case, this mod will be a nice addition for my board when 6.5.1 goes final
Posted By: Anno Re: Beta-[6.4-6.5] Restrict Images 1.0 - 01/11/2005 9:21 AM
Browser.
Posted By: donJulio Re: Beta-[6.4-6.5] Restrict Images 1.0 - 02/04/2005 8:18 AM
Would it be possible to make it so this also checks the sizes of images used in private messages?
Posted By: Anno Re: Beta-[6.4-6.5] Restrict Images 1.0 - 02/04/2005 11:57 AM
You would apply the includes accordingly to sendmessage.php and mess_reply.php .
Try it, and if you fail I'll take a closer look.
Posted By: donJulio Re: Beta-[6.4-6.5] Restrict Images 1.0 - 02/06/2005 3:25 AM
I'm sure it's not hard to figure out. Thanks!
Posted By: monkeyra Re: Beta-[6.4-6.5] Restrict Images 1.0 - 03/01/2005 7:38 PM
Just a side note here.
I'm running threads 6.5b6.

I can install version 1.0 ok, but not 2.0
In addpost.php I dont have that first line;

in addpost.php
search for:
$PrintBody = str_replace("\n","<br />",$PrintBody);

insert underneath:
$part2 = 1;
include("remotefilesize.php");
include("checkimages.php");


Thought i'd raise it FYI.
Posted By: Anno Re: Beta-[6.4-6.5] Restrict Images 1.0 - 03/02/2005 11:04 AM
Search for a line that is similar to this, something along

$PrintBody = str_replace("....something....",$PrintBody);
Posted By: Elkaholic Re: Beta-[6.4-6.5] Restrict Images 1.0 - 03/15/2005 8:48 AM
I am helping a forum resolve an issue with your mod, maybe you can help. This is the error recieved when the image is to large

Warning: getimagesize(http://test.haastylcalls.com/images/test.jpg) [function.getimagesize]: failed to open stream: HTTP request failed! ÔÜþ¿ì[ÜÜþ¿t»W1 in /home/.sites/28/site1/web/ubbthreads/checkimages.php on line 88


It also take a very long time for the post to appear, if at all when the image is under or at the required size. It seems to just hang. I think they are using 2.0 but not 100% sure.

Thanks
Posted By: AKD96 Re: Beta-[6.4-6.5] Restrict Images 1.0 - 03/15/2005 9:05 AM
What version of PHP is the server running?
Posted By: Elkaholic Re: Beta-[6.4-6.5] Restrict Images 1.0 - 03/15/2005 9:11 AM
They are not sure, I gave them a utility php file that will tell them, and or they will contact the host if they are unable to execute the file.

I figured it would have somthing to do with the version due to the code being unable to compile on line 88.
I looked at the code and it stalls on this line of code $imagehw = getimagesize($imageUrl); So I would bet that the php version does not support getimagesize.

Of course I could be wrong
Posted By: AKD96 Re: Beta-[6.4-6.5] Restrict Images 1.0 - 03/15/2005 9:18 AM
JPEG 2000 support was added in 4.3.2, so if they have earlier than that, this MAY be the problem. I'm just making a stab in the dark, though.

An easy way to get information on a PHP install is to make a PHP file that consists of:
Code
<br /><?<br />phpinfo();<br />?><br />


Call the file from your browser and it'll give you all kinds of goodies about the server's PHP install.
Posted By: Elkaholic Re: Beta-[6.4-6.5] Restrict Images 1.0 - 03/15/2005 9:23 AM
Ya I know, but from what I understand they do not have access to the server in a manner at wich they can upload stuff and not sure they trust me yet,
this is the first thing I have helped them with and don't blame them,
but we will get there. That's exactly what I sent them

BTW Thanks for your time
Posted By: scroungr Re: Beta-[6.4-6.5] Restrict Images 1.0 - 03/15/2005 9:40 AM
also keep in mind getimagesize() is part of the image module of php and is NOT loaded by default on alot of systems. BUT you said you can run small images and it works so its probably loaded....
Posted By: The Team Re: Beta-[6.4-6.5] Restrict Images 1.0 - 03/16/2005 12:33 AM
keep in mind getimagesize() downloads the image to your server first, which means it could timeout on a large image
Posted By: Anno Re: Beta-[6.4-6.5] Restrict Images 1.0 - 03/16/2005 2:03 AM
>keep in mind getimagesize() downloads the image to your server first

It doesn't actually. It only request the first few bytes of the image.
Posted By: Anno Re: Beta-[6.4-6.5] Restrict Images 1.0 - 03/16/2005 2:06 AM
> keep in mind getimagesize() is part of the image module of php

Actually "The getimagesize() function does not require the GD image library."
http://www.php.net/getimagesize
Posted By: Elkaholic Re: Beta-[6.4-6.5] Restrict Images 1.0 - 03/18/2005 3:23 AM
They are on version 5.0 of php so now what? seems to be hanging on line 88 of checkimages.php any suggestions?
Posted By: Elkaholic Re: Beta-[6.4-6.5] Restrict Images 1.0 - 03/18/2005 4:27 AM
What is happening now is it just takes a very long time to have the post happen when an image is involved. It hangs and then never really does anything. No errors now just no image checking and posts
Posted By: Anno Re: Beta-[6.4-6.5] Restrict Images 1.0 - 03/18/2005 4:44 AM
If this function is not working, then you can't get the image dimensions via this way thus you can not use this mod, sorry.
Posted By: Elkaholic Re: Beta-[6.4-6.5] Restrict Images 1.0 - 03/18/2005 4:45 AM
Nope they are on version 5.0 of PHP and it does not work. They are running UBB 6.5 and I fixed (seemed to fix) the berror, but it does not function properly. It hangs forever and then does not ever bring you back to the red square part or say anything about posting an image that is not within the settings.
Posted By: Elkaholic Re: Beta-[6.4-6.5] Restrict Images 1.0 - 03/18/2005 8:39 PM
Here is the URl for the phpinfo file, see for yourself, maybe you can tell whats up. PM PHP Info
Also this is a test link
PM Test getimagesize

Here is a test link on my site for comparison. It works on my site!

Other Test getimagesize

I think the problem is elsewhere, in the config of PHP or in the Server Config, but can not find it. Still looking though.
© UBB.Developers