|
Joined: Jul 2005
Posts: 4
Junior Member
|
Junior Member
Joined: Jul 2005
Posts: 4 |
Modification Name: image attachment hack Author(s): gsummerlin Description: good morning, i am very pleased to find your site of innovative hacks and people supporting the modification of ubb code. i have been feverously searching for an image attachment hack for my 6.6 installation. i would like the option of my users attaching images to their posts. my question is: is this possible? and if so, where do i get my grubby little hands on this magic script? of course, thanks for your help in advance, grant Demo: none Download Link: none
|
|
|
|
Joined: Oct 2002
Posts: 394
Enthusiast
|
Enthusiast
Joined: Oct 2002
Posts: 394 |
|
|
|
|
Joined: Mar 2001
Posts: 7,394
Admin / Code Breaker
|
Admin / Code Breaker
Joined: Mar 2001
Posts: 7,394 |
I'm having trouble using MultiHack unfortunately so I can't tell you what to do. (I downloaded the zip file Allen linked to but it doesn't mention %%LINK%%).
|
|
|
|
Joined: Jul 2005
Posts: 4
Junior Member
|
Junior Member
Joined: Jul 2005
Posts: 4 |
has anyone tried applying this hack to 6.6? if not, have you heard of a 6.6 image upload hack?
thanks, grant
|
|
|
|
Joined: Oct 2002
Posts: 394
Enthusiast
|
Enthusiast
Joined: Oct 2002
Posts: 394 |
Originally posted by LK:
I'm having trouble using MultiHack unfortunately so I can't tell you what to do. (I downloaded the zip file Allen linked to but it doesn't mention %%LINK%%).
Thanks LK, the %%LINK%% comes from here, Originally posted by Alan Thompson: [qb] Thanks, All,
I want to share some "enhancements." Our Forum Members are fairly unsophisticated so I need to make everything as simple as possible. Since our Members like to share image files only, I made some modifications to make it a no brainer to get the image links into posts.
Here is a simple mod to vars_wordlets.cgi to make a clickable link within the results page that will paste the link into the message window using JavaScript:
Find this line in the Upload Mod for vars_wordlets.cgi:
q!upload-_-up_success! => q!The file you uploaded was successful. You can access it by clicking <a href="%%LINK%%" target="_new">here</a>. You may also copy the following statement to use the hyperlink in your posts.
%%LINK%%
<a href="%%BACK%%">Click here to upload more files</a> or <a href="%%MANAGER%%">Click here to manage your uploaded files</a>!, Replace with the following: q!upload-_-up_success! => q!The file you uploaded was successful. You can access it by clicking <a href="%%LINK%%" target="_new">here</a>. Simply click the link below to paste it into your post (you can also copy and paste it).
<a href="javascript:void(0)" onclick="window.opener.insertAtCaret(window.opener.document.replier.message, ' [img]%%LINK%%[/img] '); window.focus();">[img]%%LINK%%[/img]</a>
<a href="%%BACK%%">Click here to upload more files</a> or <a href="%%MANAGER%%">Click here to manage your uploaded files</a>!, [/qb] I tried to make it work but I just cant. I dont know what is wrong. It should work. Can you help me? Felix
|
|
|
|
Joined: Mar 2001
Posts: 7,394
Admin / Code Breaker
|
Admin / Code Breaker
Joined: Mar 2001
Posts: 7,394 |
There is a function in MultiHack to export the instructions to TXT. Can you do that and include it as well as the hack's new files (i.e. ubb_upload.cgi) in a ZIP file?
|
|
|
|
Joined: Oct 2002
Posts: 394
Enthusiast
|
Enthusiast
Joined: Oct 2002
Posts: 394 |
Yes, certanly. MH Export and TEXT FILE Both the same. Notice the last 2 lines, is what I am trying to do. Thanks very much LK.
|
|
|
|
Joined: Mar 2001
Posts: 7,394
Admin / Code Breaker
|
Admin / Code Breaker
Joined: Mar 2001
Posts: 7,394 |
Try the following in ubb_upload.cgi: Find: #### file uploaded ###### Add below: $vars_wordlets_mods{upload_file_name_dontworry} =~ s/%%LINK%%/$vars_modifications{elym_upload_SAVE_URL}/$Filename/isg;
|
|
|
|
Joined: Oct 2002
Posts: 394
Enthusiast
|
Enthusiast
Joined: Oct 2002
Posts: 394 |
YES !!! YOU ARE AMAZING! thanks alot LK
|
|
|
|
Joined: Oct 2002
Posts: 394
Enthusiast
|
Enthusiast
Joined: Oct 2002
Posts: 394 |
LK, one more thing, please, in the CP settings there are 3 options for the filenames:
1.-Random filename. 2.-Username in filename. 3.-Member Number in filename.
Uploading by Random numers (ubb/uploads/1122295926.jpg) but makes managing impossible because all files are pile up togheter in the same folder, nobody knows what belongs to whom. The other 2 options are useles, because there only can be one file (ubb/uploads/Felix10.jpg) any new file uploaded will replace the existing.
What should I add to the script to upload by Member and Random Numeber ? (ubb/uploads/Felix10/1122295926.jpg
Thank you LK
|
|
|
|
Joined: Mar 2001
Posts: 7,394
Admin / Code Breaker
|
Admin / Code Breaker
Joined: Mar 2001
Posts: 7,394 |
Try the following in ubb_upload.cgi: Find: if (!open(OUTFILE, ">$vars_modifications{elym_upload_SAVE_DIRECTORY}/$Filename")) { Replace with: mkdir("$vars_modifications{elym_upload_SAVE_DIRECTORY}/$ubber[0]", 0777) unless (-d "$vars_modifications{elym_upload_SAVE_DIRECTORY}/$ubber[0]"); if (!open(OUTFILE, ">$vars_modifications{elym_upload_SAVE_DIRECTORY}/$ubber[0]/$Filename")) { Now search the entire file for "$vars_modifications{elym_upload_SAVE_DIRECTORY}/$Filename", and replace all instances with "$vars_modifications{elym_upload_SAVE_DIRECTORY}/$ubber[0]/$Filename".
|
|
|
|
Joined: Oct 2002
Posts: 394
Enthusiast
|
Enthusiast
Joined: Oct 2002
Posts: 394 |
getting there LK almost there, it creates a member folder, very very nice, but still I can only have one file in the folder as all are named the same and they replace the old one. Can you work your magic again? Thank you PS Uploads Folder
|
|
|
|
Joined: Mar 2001
Posts: 7,394
Admin / Code Breaker
|
Admin / Code Breaker
Joined: Mar 2001
Posts: 7,394 |
You should still set it to save the name by random number in your CP.
|
|
|
|
Joined: Oct 2002
Posts: 394
Enthusiast
|
Enthusiast
Joined: Oct 2002
Posts: 394 |
Got it, I thought there is a way to show something like ...ubb/uploads/Felix/myVW.gif instead of ...ubb/uploads/Felix/134746860.gif
Thank you LK
|
|
|
|
Joined: Mar 2001
Posts: 7,394
Admin / Code Breaker
|
Admin / Code Breaker
Joined: Mar 2001
Posts: 7,394 |
This is possible, but there may be some security vulnerabilities, if you're willing to take the risk.
|
|
|
|
Joined: Oct 2002
Posts: 394
Enthusiast
|
Enthusiast
Joined: Oct 2002
Posts: 394 |
LK, my board is for a reduced number of friends sharing the same nostalgy for the home land (Romania) and my soccer team. I dont know why would somebody want to break in and destroy what took me 3 years to build (with my limited knowledge of programming and lot of help from you guys), there is nothing there that anybody would want. So, yes, I will take the risk.
|
|
|
|
Joined: Mar 2001
Posts: 7,394
Admin / Code Breaker
|
Admin / Code Breaker
Joined: Mar 2001
Posts: 7,394 |
ubb_upload.cgi (untested): Find: $Filename = join '.', $tempname, @yourvar[$#yourvar]; Replace with: $Filename = join '.', @yourvar[0], @yourvar[$#yourvar];
|
|
|
|
Joined: Mar 2001
Posts: 7,394
Admin / Code Breaker
|
Admin / Code Breaker
Joined: Mar 2001
Posts: 7,394 |
Originally posted by LK:
Try the following in ubb_upload.cgi: Find: #### file uploaded ###### Add below: $vars_wordlets_mods{upload_file_name_dontworry} =~ s/%%LINK%%/$vars_modifications{elym_upload_SAVE_URL}/$Filename/isg;
Originally posted by LK: [qb] Now search the entire file for "$vars_modifications{elym_upload_SAVE_DIRECTORY}/$Filename", and replace all instances with "$vars_modifications{elym_upload_SAVE_DIRECTORY}/$ubber[0]/$Filename". [/qb] Do what I said in quote 2 in the code of quote 1
|
|
|
|
Joined: Oct 2002
Posts: 394
Enthusiast
|
Enthusiast
Joined: Oct 2002
Posts: 394 |
Done, but now I get this in the generated link [code][img] /home/*********/public_html/ubb/uploads/aquauomo/rear.jpg [/img]
|
|
|
|
Joined: Mar 2001
Posts: 7,394
Admin / Code Breaker
|
Admin / Code Breaker
Joined: Mar 2001
Posts: 7,394 |
Ohhh... oops... in the case of the first quote (and that case only) use elym_upload_SAVE_URL instead of elym_upload_SAVE_DIRECTORY.
|
|
|
|
Joined: Oct 2002
Posts: 394
Enthusiast
|
Enthusiast
Joined: Oct 2002
Posts: 394 |
EXCELLENT! EXCELLENT! Excuse my caps, I'm so excited. It works like a swiss watch Thank you very very much for your magical touch, again, LK Felix
|
|
|
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.
|
|
Posts: 808
Joined: July 2001
|
|
Forums63
Topics37,574
Posts293,926
Members13,850
|
Most Online5,166 Sep 15th, 2019
|
|
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
|
|
|
|