Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Jul 2005
Posts: 4
Junior Member
Junior Member
Offline
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

Sponsored Links
Joined: Mar 2001
Posts: 7,394
LK Offline
Admin / Code Breaker
Admin / Code Breaker
Offline
Joined: Mar 2001
Posts: 7,394
There is no mod for that yet, but a 6.4 version is available: https://www.ubbdev.com/ubbcgi/ultimatebb.cgi/topic/33/24.html?

Moving to New Members forum

Joined: Oct 2002
Posts: 394
Enthusiast
Enthusiast
Offline
Joined: Oct 2002
Posts: 394
Quote
Originally posted by LK:

There is no mod for that yet, but a 6.4 version is available: https://www.ubbdev.com/ubbcgi/ultimatebb.cgi/topic/33/24.html?

Moving to New Members forum
LK, can you give a hint on the topic above?

( https://www.ubbdev.com/ubbcgi/ultimatebb.cgi?ubb=get_topic&f=33&t=000024&p=5#000067 )

Thanks in advance,
Felix

Joined: Mar 2001
Posts: 7,394
LK Offline
Admin / Code Breaker
Admin / Code Breaker
Offline
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
Offline
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

Sponsored Links
Joined: Oct 2002
Posts: 394
Enthusiast
Enthusiast
Offline
Joined: Oct 2002
Posts: 394
Quote
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:

Code
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:
Code
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
LK Offline
Admin / Code Breaker
Admin / Code Breaker
Offline
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
Offline
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
LK Offline
Admin / Code Breaker
Admin / Code Breaker
Offline
Joined: Mar 2001
Posts: 7,394
Try the following in ubb_upload.cgi:

Find:
Code
#### file uploaded ###### 
Add below:
Code
$vars_wordlets_mods{upload_file_name_dontworry} =~ s/%%LINK%%/$vars_modifications{elym_upload_SAVE_URL}/$Filename/isg;

Joined: Oct 2002
Posts: 394
Enthusiast
Enthusiast
Offline
Joined: Oct 2002
Posts: 394
YES !!!
YOU ARE AMAZING! thanks alot LK smile

Sponsored Links
Joined: Oct 2002
Posts: 394
Enthusiast
Enthusiast
Offline
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
LK Offline
Admin / Code Breaker
Admin / Code Breaker
Offline
Joined: Mar 2001
Posts: 7,394
Try the following in ubb_upload.cgi:
Find:
Code
        if (!open(OUTFILE, ">$vars_modifications{elym_upload_SAVE_DIRECTORY}/$Filename")) {
Replace with:
Code
	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
Offline
Joined: Oct 2002
Posts: 394
getting there LK smile

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
smile
PS
Uploads Folder

Joined: Mar 2001
Posts: 7,394
LK Offline
Admin / Code Breaker
Admin / Code Breaker
Offline
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
Offline
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
LK Offline
Admin / Code Breaker
Admin / Code Breaker
Offline
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
Offline
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.

smile

Joined: Mar 2001
Posts: 7,394
LK Offline
Admin / Code Breaker
Admin / Code Breaker
Offline
Joined: Mar 2001
Posts: 7,394
ubb_upload.cgi (untested):
Find:
Code
	 $Filename = join '.', $tempname, @yourvar[$#yourvar];
Replace with:
Code
	 $Filename = join '.', @yourvar[0], @yourvar[$#yourvar];

Joined: Oct 2002
Posts: 394
Enthusiast
Enthusiast
Offline
Joined: Oct 2002
Posts: 394
Works good LK, one onle small glitch, when creating the link it doesnt add the user name therefore the link is broken

http://romanianational.com/ubb/uploads/team_2003.jpg

it should be in the users folder: http://romanianational.com/ubb/uploads/aquauomo/team_2003.jpg

Thank you
smile

Joined: Mar 2001
Posts: 7,394
LK Offline
Admin / Code Breaker
Admin / Code Breaker
Offline
Joined: Mar 2001
Posts: 7,394
Quote
Originally posted by LK:

Try the following in ubb_upload.cgi:

Find:
Code
#### file uploaded ###### 
Add below:
Code
$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 smile

Joined: Oct 2002
Posts: 394
Enthusiast
Enthusiast
Offline
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]

confused confused

Joined: Mar 2001
Posts: 7,394
LK Offline
Admin / Code Breaker
Admin / Code Breaker
Offline
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
Offline
Joined: Oct 2002
Posts: 394
devilchili EXCELLENT! EXCELLENT! devilchili
Excuse my caps, I'm so excited. It works like a swiss watch smile

Thank you very very much for your magical touch, again, LK

Felix
smile


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
Gizmo
Gizmo
Portland, OR, USA
Posts: 5,833
Joined: January 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)