Previous Thread
Next Thread
Print Thread
Rate Thread
Beta-[6.4-6.5] Restrict Images 2.0
#282861 01/04/2005 8:05 AM
Joined: May 2001
Posts: 550
Anno Offline OP
Code Monkey
OP Offline
Code Monkey
Joined: May 2001
Posts: 550
***~~~ 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 Files
124272-checkimages1.0.zip (0 Bytes, 45 downloads)
Last edited by Anno; 01/06/2005 3:40 AM.
Sponsored Links
Re: Beta-[6.4-6.5] Restrict Images 1.0
domain123 #282862 01/04/2005 9:16 AM
Joined: Dec 2000
Posts: 1,471
Addict
Offline
Addict
Joined: Dec 2000
Posts: 1,471
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.

Re: Beta-[6.4-6.5] Restrict Images 1.0
-Fusion- #282863 01/04/2005 10:31 AM
Joined: May 2001
Posts: 550
Anno Offline OP
Code Monkey
OP Offline
Code Monkey
Joined: May 2001
Posts: 550
>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.

Re: Beta-[6.4-6.5] Restrict Images 1.0
domain123 #282864 01/04/2005 7:40 PM
Joined: May 2001
Posts: 550
Anno Offline OP
Code Monkey
OP Offline
Code Monkey
Joined: May 2001
Posts: 550
Version 2.0 in the attachment.

Attached Files
124297-RestrictImages2.0.zip (0 Bytes, 68 downloads)
Re: Beta-[6.4-6.5] Restrict Images 1.0
domain123 #282865 01/04/2005 10:39 PM
Joined: Jun 2002
Posts: 670
Code Monkey
Offline
Code Monkey
Joined: Jun 2002
Posts: 670
[]Anno said:
Version 2.0 in the attachment. [/]

And what's in version 2.0?

Sponsored Links
Re: Beta-[6.4-6.5] Restrict Images 1.0
luan #282866 01/05/2005 3:24 AM
Joined: May 2001
Posts: 550
Anno Offline OP
Code Monkey
OP Offline
Code Monkey
Joined: May 2001
Posts: 550
>If an image is to large, redirect to the post preview page and display a red
>border arround the image that is too large.

Re: Beta-[6.4-6.5] Restrict Images 1.0
domain123 #282867 01/10/2005 1:12 PM
Joined: Jun 2002
Posts: 670
Code Monkey
Offline
Code Monkey
Joined: Jun 2002
Posts: 670
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?

Re: Beta-[6.4-6.5] Restrict Images 1.0
luan #282868 01/10/2005 5:05 PM
Joined: May 2001
Posts: 550
Anno Offline OP
Code Monkey
OP Offline
Code Monkey
Joined: May 2001
Posts: 550

Re: Beta-[6.4-6.5] Restrict Images 1.0
domain123 #282869 01/11/2005 12:20 AM
Joined: Jun 2002
Posts: 670
Code Monkey
Offline
Code Monkey
Joined: Jun 2002
Posts: 670
[]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

Re: Beta-[6.4-6.5] Restrict Images 1.0
luan #282870 01/11/2005 1:21 AM
Joined: May 2001
Posts: 550
Anno Offline OP
Code Monkey
OP Offline
Code Monkey
Joined: May 2001
Posts: 550
Browser.

Sponsored Links
Re: Beta-[6.4-6.5] Restrict Images 1.0
domain123 #282871 02/04/2005 12:18 AM
Joined: Jun 2002
Posts: 670
Code Monkey
Offline
Code Monkey
Joined: Jun 2002
Posts: 670
Would it be possible to make it so this also checks the sizes of images used in private messages?

Re: Beta-[6.4-6.5] Restrict Images 1.0
luan #282872 02/04/2005 3:57 AM
Joined: May 2001
Posts: 550
Anno Offline OP
Code Monkey
OP Offline
Code Monkey
Joined: May 2001
Posts: 550
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.

Re: Beta-[6.4-6.5] Restrict Images 1.0
domain123 #282873 02/05/2005 7:25 PM
Joined: Jun 2002
Posts: 670
Code Monkey
Offline
Code Monkey
Joined: Jun 2002
Posts: 670
I'm sure it's not hard to figure out. Thanks!

Re: Beta-[6.4-6.5] Restrict Images 1.0
luan #282874 03/01/2005 11:38 AM
Joined: Jun 2001
Posts: 356
Junior Member
Offline
Junior Member
Joined: Jun 2001
Posts: 356
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.

Re: Beta-[6.4-6.5] Restrict Images 1.0
Luka_dup1 #282875 03/02/2005 3:04 AM
Joined: May 2001
Posts: 550
Anno Offline OP
Code Monkey
OP Offline
Code Monkey
Joined: May 2001
Posts: 550
Search for a line that is similar to this, something along

$PrintBody = str_replace("....something....",$PrintBody);

Re: Beta-[6.4-6.5] Restrict Images 1.0
domain123 #282876 03/15/2005 12:48 AM
Joined: Mar 2005
Posts: 11
Newbie
Offline
Newbie
Joined: Mar 2005
Posts: 11
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

Re: Beta-[6.4-6.5] Restrict Images 1.0
jgohring #282877 03/15/2005 1:05 AM
Joined: Aug 2000
Posts: 1,609
Addict
Offline
Addict
Joined: Aug 2000
Posts: 1,609
What version of PHP is the server running?

Re: Beta-[6.4-6.5] Restrict Images 1.0
eslmix #282878 03/15/2005 1:11 AM
Joined: Mar 2005
Posts: 11
Newbie
Offline
Newbie
Joined: Mar 2005
Posts: 11
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

Last edited by Elkaholic; 03/15/2005 1:13 AM.
Re: Beta-[6.4-6.5] Restrict Images 1.0
jgohring #282879 03/15/2005 1:18 AM
Joined: Aug 2000
Posts: 1,609
Addict
Offline
Addict
Joined: Aug 2000
Posts: 1,609
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.

Re: Beta-[6.4-6.5] Restrict Images 1.0
eslmix #282880 03/15/2005 1:23 AM
Joined: Mar 2005
Posts: 11
Newbie
Offline
Newbie
Joined: Mar 2005
Posts: 11
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

Last edited by Elkaholic; 03/15/2005 1:31 AM.
Re: Beta-[6.4-6.5] Restrict Images 1.0
jgohring #282881 03/15/2005 1:40 AM
Joined: Oct 2003
Posts: 2,305
Old Hand
Offline
Old Hand
Joined: Oct 2003
Posts: 2,305
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....

Re: Beta-[6.4-6.5] Restrict Images 1.0
234234 #282882 03/15/2005 4:33 PM
Joined: Aug 2000
Posts: 3,590
Moderator
Offline
Moderator
Joined: Aug 2000
Posts: 3,590
keep in mind getimagesize() downloads the image to your server first, which means it could timeout on a large image

Re: Beta-[6.4-6.5] Restrict Images 1.0
javiersbabygirl #282883 03/15/2005 6:03 PM
Joined: May 2001
Posts: 550
Anno Offline OP
Code Monkey
OP Offline
Code Monkey
Joined: May 2001
Posts: 550
>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.

Re: Beta-[6.4-6.5] Restrict Images 1.0
234234 #282884 03/15/2005 6:06 PM
Joined: May 2001
Posts: 550
Anno Offline OP
Code Monkey
OP Offline
Code Monkey
Joined: May 2001
Posts: 550
> 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

Re: Beta-[6.4-6.5] Restrict Images 1.0
jgohring #282885 03/17/2005 7:23 PM
Joined: Mar 2005
Posts: 11
Newbie
Offline
Newbie
Joined: Mar 2005
Posts: 11
They are on version 5.0 of php so now what? seems to be hanging on line 88 of checkimages.php any suggestions?

Re: Beta-[6.4-6.5] Restrict Images 1.0
jgohring #282886 03/17/2005 8:27 PM
Joined: Mar 2005
Posts: 11
Newbie
Offline
Newbie
Joined: Mar 2005
Posts: 11
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

Re: Beta-[6.4-6.5] Restrict Images 1.0
jgohring #282887 03/17/2005 8:44 PM
Joined: May 2001
Posts: 550
Anno Offline OP
Code Monkey
OP Offline
Code Monkey
Joined: May 2001
Posts: 550
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.

Re: Beta-[6.4-6.5] Restrict Images 1.0
jgohring #282888 03/17/2005 8:45 PM
Joined: Mar 2005
Posts: 11
Newbie
Offline
Newbie
Joined: Mar 2005
Posts: 11
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.

Re: Beta-[6.4-6.5] Restrict Images 1.0
jgohring #282889 03/18/2005 12:39 PM
Joined: Mar 2005
Posts: 11
Newbie
Offline
Newbie
Joined: Mar 2005
Posts: 11
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.


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
jgeoff
jgeoff
NJ
Posts: 96
Joined: April 2001
Forum Statistics
Forums63
Topics37,529
Posts293,721
Members13,834
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online 130
Topics Created 0
Posts Made 0
Users Online 0
Birthdays 28
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,795
Greg Hard 4,625
Top Posters(30 Days)
isaac 3
Top Likes Received
isaac 33
Gizmo 8
Brett 7
Morgan 2
Top Likes Received (30 Days)
isaac 3
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2020 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 7.7.4
(Snapshot build 20200228.dev)
Responsive Width:

PHP: 5.4.45 Page Time: 0.084s Queries: 75 (0.031s) Memory: 3.4997 MB (Peak: 3.8443 MB) Data Comp: Zlib Server Time: 2020-02-29 12:18:14 UTC
Valid HTML 5 and Valid CSS