The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Attachments Hack
I apologize if a hack already exists:
1) I would like to center images on the post when a screenie gets uploaded, instead of it aligning to the left margin. 2) Be able to upload more than one image/attachment on a post. 3) Finally, When an image is uploaded have it resize to lets say 800x600 and if it was originally bigger make the image click-able so you can see the full image. That way big images can get uploaded without destroying the margins and making a thread look like crap. Any of these options available, if not how hard will it be? Thanks in advanced. |
#2
|
||||
|
||||
1 and 3 I can sort for you, just a sec...
|
#3
|
||||
|
||||
Edit template: postbit_attachmentimage
Replace entire contents with: Code:
<smallfont>$post[username] has attached this image:<p> <center><a href="attachment.php?s=$session[sessionhash]&postid=$post[postid]"><img width="800" src="attachment.php?s=$session[sessionhash]&postid=$post[postid]" border="0" alt="Click to open the image in a new window" vspace="8" hspace="4"></smallfont></center></p> |
#4
|
||||
|
||||
Thanks a lot dude! Going to try it now
How hard will it be to make it possible to upload more than one image per post? I really would like that. Perhaps dublicate the attachment code or something? :P Thanks again. |
#5
|
||||
|
||||
Something I've just thought of on my code above. If someone upload a SMALL image, it stretches it to 800. So if you want to remove the 800 width bit just remove:
Code:
width="800" |
#6
|
||||
|
||||
aww.. is there a way not to resize the image if it's smaller than 800x600?
I really, really want this bad :P It makes the threads look so much cleaner. Thanks again. |
#7
|
||||
|
||||
Can anyone get this code not to resize an image if it's smaller than the size specified? This works awesome, in keeping threads clean :P
|
#8
|
||||
|
||||
Well it will be within attachment.php, and would be easier done on file size I'd expect, with the > sign... But I can't help much...
|
#9
|
||||
|
||||
Tim's solution is wise and it forces the image to resize with HTML. But it is inevitable that all images will be forced to be in that size if you use HTML.
To make some (largers) resize and others (smalls) stay as it is you need to handle the job in PHP, not in HTML and to handle it your code needs to know what is the image size so that it can take actions accordingly. Unfortunately I cant see an easy way to manage your goal in PHP. AFAIK the image size of the attachment is not saved in the attachment table so its not possible to know the dimensions of the image by checking your db. There is a special function "getimagesize" in PHP which would be a remedy for your problem but its not a default PHP function but a part of an additional image library. In other words so as to use this function (and to get the image size) your PHP should be equipped with image library by installing it. It's a server side library so your host must be installing it and for the same reason even if the solution is provided, it will not work for all users since many hosts wouldnt include this library in their PHP configuration. As for multi-attachments hack: It's a long waited hack but not released here. Neo says he is working on it for a long time but if you make a list of hacks Neo says he is working on, you can really doubt if he can finish any of this very long list soon. I also know there is commercial version of this hack coded by someone and sold commercially. But I dont know his name.. |
#10
|
||||
|
||||
Thanks for the reply. I know it never can be done using .html, I haven't been using vb that long to know what files need to be edited, etc.. I didn't think this would be this complicated as I know a forum that has this feature implemented, though I think it's some sort of perl forums. maybe down the road as I get more familiar with vb I can do it myself. In the mean time I am sure a vb guru can knock this out in 10 minutes.
As for the attachment, I don't care for it as much, It would be useful.. I am hearing it's probably going to be added to vb3. Thanks for the help. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|