Previous Thread
Next Thread
Print Thread
Rate Thread
#222303 08/11/2002 9:15 PM
Joined: Jun 2002
Posts: 375
Enthusiast
Enthusiast
Offline
Joined: Jun 2002
Posts: 375
Mod Name / Version - Image Gallery v1.0
Description - Turns a selected forum into a picture gallery allowing permitted groups to post and comment on uploaded images. Uses existing attachment features and file size limits.
Example -
http://www.newoutriders.org/ubbtest/postlist.php?Cat=&Board=gallery
Pre-requisites - none
Author - Aglavalin, aka Steve Stout
Files Altered - showflat.php, showflat.tmpl, showthreaded.php, showthreaded.tmpl
Database Altered - no
New Files - none
Note: Use group permissions on forum(s) to determine who can post.
Any other info - this is a simple hack


Here is my first real hack. It turns a forum into a basic image gallery which could be pulled into an IIP page very easily. It allows users to comment on the images as well. This took me a few days to figure out, and it seems to be working fine. The only thing I could not figure out was how to check if the attachment was an image before displaying it. Perhaps someone could clue me in on how to do this?
Attachments
53952-ImageGallery_v1.0.txt (0 Bytes, 51 downloads)

Sponsored Links
neuron #222304 08/11/2002 11:12 PM
Joined: Mar 2000
Posts: 21,079
Likes: 3
I type Like navaho
I type Like navaho
Joined: Mar 2000
Posts: 21,079
Likes: 3
interesting, has great possibilities I am getting a parse error on your example forum. Please post when it's up, I'd like to check it out


- Allen wavey
- What Drives You?
Joined: Jun 2002
Posts: 375
Enthusiast
Enthusiast
Offline
Joined: Jun 2002
Posts: 375
Hmm, not sure what I did there, but it's fixed now, lol

Joined: Aug 2002
Posts: 17
Newbie
Newbie
Offline
Joined: Aug 2002
Posts: 17
Very nice, and simple mod. Good work.

leo #222307 08/12/2002 8:41 PM
Joined: Jun 2002
Posts: 375
Enthusiast
Enthusiast
Offline
Joined: Jun 2002
Posts: 375
I just added instructions to upgrade the newspal.php file in IIP 4.3 to display the images from the image gallery, such as use on a homepage or whatnot.


Optional code to make images show up in the newspal.php file with IIP 4.3

Open newspal.php and find:

if ($palFile) {
$epalFile = rawurlencode($palFile);
$attachment = "<BR>{$ubbt_lang['FILE_ATTACH']} <a href="{$config['fileurl']}/$epalFile">$palFile</a>";
}
else {
$attachment = "";
}


and REPLACE it with:

if ($palFile) {
$epalFile = rawurlencode($palFile);
$attachment = "<BR>{$ubbt_lang['FILE_ATTACH']} <a href="{$config['fileurl']}/$epalFile">$palFile</a>";
}
if ($postdisplay[$i] == "FORUM_NAME") {
$attachment = "<center><img src="{$config['fileurl']}/$epalFile"></center><br><br>";
}
else {
$attachment = "";
}


Edit FORUM_NAME to match the forum name you will use as your image gallery forum.


You can view this addon in action at http://www.newoutriders.org/index.php
Attachments
54024-ImageGallery_v1.1.txt (0 Bytes, 56 downloads)

Sponsored Links
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
As per only trying to insert it if the file is an image. There was an old hack like this one... I'm using it on my board... except that I've got it set to all boards.

I haven't tested this.... but here's the code that checks if it's a .jpg or .gif ....

So maybe you need something like this:

code:


if ($File) {
$File = rawurlencode($File);
$postrow[$i]['filelink'] = "<a href="{$config['fileurl']}/$File">{$ubbt_lang['FILE_ATTACH']}</a>";

//---------------------------
//image gallery addon
if ($Board == "FORUM_NAME" and (eregi("\.GIF|\.JPG|\.PNG", $File))) {
$postrow[$i]['showfile'] = "<center><img src="{$config['fileurl']}/$File"></center><br><br>";
}
}



Again.... haven't tested this... I'm not a PHP expert and don't know if I've got the syntex of an if statement with an "AND" correct or now.... but the old hack that JustDave wrote for 5.5 used "if (eregi("\.GIF|\.JPG|\.PNG", $File))" to check if it was a GIF, JPG or PNG file.

Hope that helps!
Josh

Daine #222309 08/12/2002 11:56 PM
Joined: Jun 2002
Posts: 375
Enthusiast
Enthusiast
Offline
Joined: Jun 2002
Posts: 375
Yep, that works I've updated the directions to include this on the changes to showflat.php, showthreaded.php and newspal.php .

Thanks for the help, I think this hack is working as I intended now

Attached is the latest and I hope finished version.
Attachments
54034-ImageGallery_v1.2.txt (0 Bytes, 59 downloads)

Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
Just a small thought, you could modify the code that inserts the disk image on the postlist to show an image that indicates the posts includes an image instead?

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369

Daine #222312 08/13/2002 10:21 AM
Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
From what I could see on his board that hack was already installed. But what I meant was to extend that hack to show an icon describing an image (like a canvas, a palette or something) instead of the diskette icon when applicable.

The reason I thought of this was that he had two test threads, one with an included image and one with a text file attached. From the postlist, both showed a diskette icon, which made it seem like both had an image inside it. That is, since that particular forum should be an image gallery. Of course, if only posts with images are posted in the forum it won't really matter, the disk would mean that the post has an image in it. But still, something showing an image would be better IMHO.

Sponsored Links
c0bra #222313 08/13/2002 10:57 AM
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Attachments
54056-camera.gif (0 Bytes, 65 downloads)

Last edited by JoshPet; 08/13/2002 10:58 AM.
Daine #222314 08/13/2002 11:20 AM
Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
Yup, that's what I mean.

Joined: Jun 2002
Posts: 375
Enthusiast
Enthusiast
Offline
Joined: Jun 2002
Posts: 375
Yeah I had a post with a text file for testing purposes. This seperate image for a graphic attachment seems like it should be added onto the attachment image hack to me. Maybe I'll add this to my board, gotta think about it first

Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
Yes, I guess that would be the best place to put it. Maybe it could be expanded to recognize archives, text files etc, and show different pictures depending on what it is.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
I was just thinking about doing a revision to the attachment image hack to make a distinction for .zip files, graphics, .txt and my board posts alot of video clips..... it would be cool with a logo to indicate video files.

I'll get to work.

I wonder how all this will work with 6.1 since there is that download script? I wonder if that will get in the way of this type of stuff?

Joined: May 1999
Posts: 1,715
Addict
Addict
Joined: May 1999
Posts: 1,715
The filename of the file should still be in the database, so it's just a matter of reading that. I don't think there will be any problems, you will probably need to change the code a bit though.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Great.... as long as the filename is in the database it should be no problem.

Joined: Jun 2002
Posts: 375
Enthusiast
Enthusiast
Offline
Joined: Jun 2002
Posts: 375
Has anyone had any issues using this hack? It seems pretty stable to me and I'll move it to finished status if no problems are reported. I'm planning on updating it if needed for the 6.1 version after I install a copy.

Joined: Jun 2002
Posts: 375
Enthusiast
Enthusiast
Offline
Joined: Jun 2002
Posts: 375
This hack is being moved to finished mods forum. It also has been updated for 6.1

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Finished Mod can be found here.


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
AllenAyres
AllenAyres
Texas
Posts: 21,079
Joined: March 2000
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)