vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   [RELEASE] Image Gallery Hack v0.9 (https://vborg.vbsupport.ru/showthread.php?t=3506)

09-27-2000 02:27 PM

How do all..

I am going to release my image gallery hack (in action http://www.overgrow.com/edge/index.php) without the admin piece.. I am still trying to finish it up without having to re-write all the vB delete routines.. Plus some of you may want to write your own way of administering the images that get uploaded and keeping things clean..

When my admin piece is finished I will post it here as well..

Features: Not too many.. very basic..

-- Only allows gif or jpg files to be uploaded.. I'm sure you can easily modify this for other file types.. PHP really makes things easy..

-- To start a thread in the gallery you must upload an image.. (doesn't apply when replying)

-- You can set a file size limit for upload..

-- Stores information in a new vB table for use later.. (ie; admin stuff. Currently the admin piece is in progress..)

You can download the instructions here - http://www.overgrow.com/tmp/imggalhack.zip

It is a fairly simple hack with a few mods to global.php, newthread.php and newreply.php and a few new templates.. It is not automated, the download is just a text file with the modification intructions..

Please let me know if I made the instructions to confusing and what ya think..

Have Fun..
Herb

09-27-2000 03:04 PM

I don't know regular expressions in PHP by the back of my hand but there has got to be a way to replace the following lines with just one line of code:

Code:

      $fileupload_name = str_replace(" ","",$fileupload_name);
      $fileupload_name = str_replace("%","",$fileupload_name);
      $fileupload_name = str_replace("!","",$fileupload_name);
      $fileupload_name = str_replace("@","",$fileupload_name);
      $fileupload_name = str_replace("#","",$fileupload_name);
      $fileupload_name = str_replace("~","",$fileupload_name);
      $fileupload_name = str_replace("^","",$fileupload_name);
      $fileupload_name = str_replace("&","",$fileupload_name);
      $fileupload_name = str_replace("+","",$fileupload_name);
      $fileupload_name = str_replace("=","",$fileupload_name);

Otherwise, nice job Herb ;)

09-28-2000 03:23 AM

Excellent man I've been waiting a long time for this, Thank you!

09-28-2000 06:41 PM

upimage should be filename or the other way around. please note this....ROCK on...i love this image hack

09-28-2000 08:31 PM

Quote:

upimage should be filename or the other way around. please note this....ROCK on...i love this image hack
Not sure what you mean here.. upimage should be upimage.. this is the field name in the table, filled on the insert by the variable TheFileNameIs.. Your welcome to change it to something else though.. ;)

09-28-2000 09:12 PM

i don't know how to explain it really in depth, i have been up to late. but i will just show you what i am talking about, the table created doesn't have a field for upimage. so upimage should be filename.

Code:

CREATE TABLE imagegal (
  imagegalid int(10) unsigned DEFAULT '0' NOT NULL auto_increment,
  postid int(10) unsigned DEFAULT '0' NOT NULL,
  filename varchar(100) NOT NULL,
  username varchar(50) NOT NULL,
  userid int(10) unsigned DEFAULT '0' NOT NULL,
  PRIMARY KEY (imagegalid)
);


Code:

      if (isset($fileupload)) {

      $DB_site->query("INSERT INTO imagegal (imagegalid,postid,upimage,username,userid) VALUES ('NULL','$mypostid','$TheFileNameIs','".addslashes($username)."','$userid')");

      }

cause i got this error

Code:

Database error in vBulletin: Invalid SQL: INSERT INTO imagegal (imagegalid,postid,upimage,username,userid) VALUES ('NULL','15','CaddilacEscalade.gif','poil11','1')
mysql error: Unknown column 'upimage' in 'field list'
mysql error number: 1054
Date: Thursday 28th of September 2000 01:57:59 PM
Script: /boards/newthread.php
newthread.php?action=newthread&forumid=24


09-28-2000 09:20 PM

you are right my man.. My bag.. As soon as my ftp server comes back I will re-upload with the correct field name..

thanks..

09-29-2000 02:47 AM

Herb could you please let us know once you have uploaded the file?

09-29-2000 03:57 AM

ok I have changed the imageupload for filename, but how would I go if I did not want the users to HAVE to upload a picture when starting a thread?
How can I remove this option, so users can upload pictures whenever they want?
NOTE: this is prolly very easy to do, I apologize for my ignorance on PHP!

Thanks

09-29-2000 01:21 PM

conan - I uploaded the new zip with the correct create table fields.. sorry about that..

Quote:

How can I remove this option, so users can upload pictures whenever they want?
Ok in newthread.php find this code that you added for the hack..

Code:

if (isset($fileupload)){
and change it to

Code:

if (isset($fileupload) and $fileupload != "none") {
Then below the above should be

Code:

if ($fileupload == "none") {
      eval("echo standarderror(\$bbtitle,\"".gettemplate("error_filenone")."\");");
      exit();
      }

Remove that check..

Then find

Code:

    // ##### Image Upload Hack (update image table) #####

      if (isset($fileupload)) {

      $DB_site->query("INSERT INTO imagegal (imagegalid,postid,upimage,username,userid) VALUES ('NULL','$mypostid','$TheFileNameIs','".addslashes($username)."','$userid')");

      }

    // ##### Image Upload Hack (update image table) #####

and change it to:

Code:

    // ##### Image Upload Hack (update image table) #####

      if (isset($fileupload) and $fileupload != "none") { {

      $DB_site->query("INSERT INTO imagegal (imagegalid,postid,upimage,username,userid) VALUES ('NULL','$mypostid','$TheFileNameIs','".addslashes($username)."','$userid')");

      }

    // ##### Image Upload Hack (update image table) #####


I think that should do it for ya..

Herb



[Edited by Herb on 09-29-2000 at 10:25 AM]


All times are GMT. The time now is 07:05 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01105 seconds
  • Memory Usage 1,747KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (9)bbcode_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete