![]() |
Server-side Thumbnailed Attachments
Thumbnailed Attachments Version 1.0
Description: Its kind of Self explanitory, but in anycase if you dont know what it does, it checks if an attached image is larger than your specified size and if it is it will use ImageMagick, Netpbm, or the GD Image functions to resize it accourdingly using a rather simple formula to make sure the thumbnails are kept in scale. Usual Mod Warning: This moddification unlike most other thumbnailed attachment mods isn't only a template hack so mind you, you'd have to make sure you backup your files before using this hack. Screenshots/Test Threads: I have one included below and this link contains a vB that has already been modded: http://www.cheatandwin.com/forums/sh...=&threadid=216. But i should let you know that both are kind of outdated already since i did update the instructions from an oversight i had made earlier.. Requirements: Umm, as vB goes i'd say you'd need 2.2.x or higher but i designed it under 2.3.3 so there might be slight differences namely in the templates but not much to worry about that.. PHP 4.0.6 <- For the moment that is the minimum requirement for the modifications i have made aside to the ones required for vB Any of the following 3: ImageMagick, Netpbm, or GD 2.01 or higher Thats about it, any comments, suggestions, or questions feel free to post here or even email me personally at cvmagic at cheatandwin dot com. [edit] New Updated Version Download Today! |
intresting hack, but in your sample forum, some of the desktop photos didn't resize and they scroll hella far to the right. I might install this later today.
|
Nice idea although i believe something similar has been done. Ill be sure too check this out later, Thanks
|
@Shell Geeks:
actually in that demo i took an exsisting thread, and for a while the users thought that the attachments didnt work, so they posted with image tags, look at the source if you want.. @MindTrix: I do hope not, lol when i started the hack earlier today or yesterday im not sure lol, i did a simple search for this hack and only could find the template versions of this hack( in the sence that they'd use the image tags to resize for them client side) or a gallery hack but not one that directly modified attachment.php to generate the thumbs |
In which case it hasnt been made then, so Congrats!!!
Im also guessing this is your first hack here at vb.org so congratulations on that also, hope to see more from you :) Long Live vB2!!! |
Looks good - I know a client of mine was looking for this so thanks ;)
|
Hmm.. nice, I will try this on my test forum. How will yours handle images smaller than the values you set up? The thumbnail hack I use now wont ignore smaller images sizes and will resize them up to the set values.
Just as a FYI, there are 2 other "thumbnailing" hacks, one as you pointed out is template, the other is vbcode. https://vborg.vbsupport.ru/showthread.php?t=52685 https://vborg.vbsupport.ru/showthrea...threadid=52344 Chris :) |
still doen't get what it is, what's for rour XP screenshot?
|
@gmarik:
Well the screenshot shows a thumb that was created from a 1280 x 780 image, I needed to pick something that most people would think was big. @chrisvonc: Yes, smaller images arent resized they are in actuality are the original image, so needing to load the GD libraries is not required. @MindTrix: ^_^ yes it is my 1st hack, i wanted my first post to be one |
Is there a way to cache the thumbnail? Your current method isn't effiecent. If the forum has alot of image attachments, this hack could bog down the server because it would have to dynamicly create the thumbnail each time the page loads. Also I looked at the code, if the thread has quite a few images atatched, it will greatly increase the page load time because it generated each thumbnail and uses resampling which isn't the fastest method but the best quality method.
This hack is great for small forums, but larger ones that have alot of attached images would see a performance decrease if they have alot of page views. |
Quote:
|
I dont mean to double post, but since no one has replied yet i have to,... I actually got the requested cache in place and options added in the Admin panel under options so you wont need to edit attachments.php everytime you want to change thumbnail sizes or change cache directories, i have included updated instructions, and im planning to add upgrade instructions just incase( i doubt you'd need it tho because its all simple enough )...
[File Updated, Please download it again if you have downloaded it already] |
Excellent hack, just what I was looking for to be honest. A lot of my users like to post photographs of themselves and gigs they've been to, only trouble is my forum has an 800 pixel width, which always gets shunted around when people post large images. This is ideal. :D
Thanks! |
^_^ thanks, if your all interested im soon going to take this hack and add it support to scott's filebased attachements then officially release it, because it seems from all the forum versions i've tested it with its been rather flawless, and when it hasnt it were mainly due to permission issues on setting up the directories, lol yeah i dont follow my own instructions :-P
|
Any chance of getting Image Magick support for this great hack?
|
Sure, ill add that to my todo list
|
That would be great CVMagic - Im running 3 gamma now and I know it has integrated thumbnailing of attachments but GD is limited to certain filetypes. ImageMagick supports almost all image formats, plus its much easier to install for those of us with our own servers. Much appreciated I like your clean mod.
|
by the way as for ImageMagick intergration do you perfer just running direct exec commands or having ImageMagick Commands intergraded into php? I much Perfer the intergraded ones over exec ones because of security reasons and the fact that some servers disallow exec commands but the thing about intergraded ones for php is that you have to rebuild your server, so ill code it accourding to what you think is best in this case.
|
Either way would be fine I would imagine, vbulletin is commercial product that is normally run on a dedicated server anyways. I personally have written most of my thumbnailing scripts using the system commands, ya know adding both types wouldnt really be hard since the system commands are one line using convert program.
|
^_^ okay im done, i just added support for No Imaging for those people who wanted to add this hack and planning to move to a new server that has GD or otherwise soon, Netpbm Support which i frankly like better than both GD and ImageMagick, ImageMagick Support for those people who want it :-D, GD2 was there already but now i have function verification so you wont get those nasty errors if lets say you dont have 2.0.1 or higher installed, and i made sure that scott's attachments as files hack wont interfere, as a side note when scott released that he was still a genious since i still dont have to modify any of his code to make this hack to work which may i say i was happy about....
So overall the requirements needed now to run this hack now are none, the requirements are set to whatever functions you have set to work rather than just GD... Oh and i also made sure that possible security holes are covered to avoid someone sneaking in a abritary command when converting ;)... It will be posted on the 1st post as an attachment, enjoy :) |
CVMagic - excellent hack - this is how hacks should be made, clean simple, not much modification. Thank you kindly!
|
Hmm...well I added the script but I'm getting broken images now and when you click on the broken thumbnail image it takes you to the real picture.
|
that is odd, can you add '&dl=1' to the attachment url and post the results of the error..
|
Okay, I debugged the issue, and it was a simple error in my part that my version of php for windows didnt pick up which i odd i must say so here is the simple fix
Code:
----------- |
Nice hack, however I have a problem. I set the max size of an image to 200x200 and the size to 1 mb. I try to upload a file that is 500x400 and vb warns that the image is too big to upload. (Exceeds the 200x200 I set)
I am on VB 2.3.3 I have no other hacks installed in the attachments.php I ran the Sql quarries and verified there existence in the db I triple checked the php additions I have disable GD 2+ and tried enabled as well I set the imagemagak 2 1 and have the exact path. It is making a image to the thumbs folder but not the size I told it to. "150x150" If I up the size of my image allowance it uploads the image and does say "Click here to enlarge" but the image in the thread is the same size as the attached image in the thread. Hope I explained this well enough. Let me knoe if not. Chuck |
Had some problems getting this to work.
The problems I've encountered were: 1. The main problem is because it resizes on the fly when a page loads. If you're applying to this hack to a busy site, you can sometimes as we do have 5+ images in a thread. Although it seems to work when there's just one image, any more and it seems like the script doesn't have long enough to complete the conversion and you end up with broken images, and corrupt files in the thumbs dir. Is there any way to give the script time to generate the thumbnails. Alternatively if a script could be created to convert all images store in the directory in one hit, might take some time, but its where you'll eventually end up - and I think it can cope with converting one image on a thread as a new post is made. 2. ImageMagick worked in that it created a resized thumbnail but for some reason it generated the name without quotes - but the script is expecting those since it uses the php function escapeshellarg for the filename. Anyone know a way round this? 3. Couldn't get NetPBM to reduce the image size, it simply created a copy of the oversized image to display. Great hack, and potentially what I've been looking for - but unworkable on my forum unfortunately. Any assistance much appreciated. |
:-P what can i say, sorry about the delay... i should note that with safemode this hack does not run well at all, I didnt code it with making it safemode compatible in mind at all..., but as in multiple images at a time, it should work just fine because w/o safemode the images have all the time in the world to complie its thumbnails and plus if a user were to press stop it still continues on its own(again not safe mode compatible)... but noted i was using a much older version of netphm and imagemagick so it might not work as i intended at all, but dont worry at all im working on a newversion that instead of processing the attachment on post view it will do it during the post thus be safemode compatible in a sence...
|
Quote:
|
Can you help me CVMagic?
In my forum, I obtain any broken thumbnails, look: http://www.indicedivx.com/foro/showt...threadid=24416 OR http://www.indicedivx.com/foro/showt...threadid=23930 (You need register for show thumbs. Login: testing, pass: testing) Thanks |
I've PMed you on your site already with the name: CVMagic, but in anycase if you have blocked out PMs, there might be 2 issues one that the file was somehow interupted during thumbnail generation which your solution would to be just deleting all the thumbs and let the script generate all the thumbs again, if its the second issue til this day gets me which is the your using GD2 it as some problem with some gif files and wont allow it to go beyond reading it at all which then i'd just either recommend disabling gif file uploading or getting Imagemagick or Netphm with gif/jpeg/jpeg2000/png support and using them as your method to thumbnail images...
[edit] There is another method too, actually its a work around if you dont want to install those other 2 programs, it means that those bad gif files will go unresized but hey its alot better than an X no? well here is the code you need to replace: PHP Code:
PHP Code:
|
Thanks for the reply. I have tried many different settings to no avail. I am of the opinion there is a server issue with imagemagik and GD. Don't know what it is yet.
Thanks for the reply... |
Will this be ported to vB3? I will be your dearest friend. Well, not quite that dear!
Regards, Matt |
Thank you CVMagic, my problem is solved :)
|
@tcs:
Can you try out one of the attachments and add &dl=1 to the url address and tell me what error it says, it might be a simple error that i could fix for you... @memobug: I believe vB3 has it built in but ill take a look at it and make it so, just as long as there is a demand for it |
Hi CVMagic,
The resizing of image attachments to conform to max pixel sizes is not built in to vB3. What is integrated is a thumbnailing feature that will take your attachment (whatever size it is) and produce a thumbnail image that can be used for inline display (default is 100pix) - linked to the original, unresized image. vB3 does not manipulate images to conform to max size standards. If size checking is enabled, it will simply say the image is too large. For those others who have asked about having an auto-size feature, it was recommended at Vbulletin.com that a hack be requested at Vbulletin.org. I have seen a few requests already for avatar and profile picture resizing on this forum, too, so I am sure there is a demand for autosizing. Best, Matt |
Hi CVMagic,
Many thanks for your feedback. Regarding safemode, I don't actually have this turned on and I don't have a particularly short timeout for scripts because some of the ones I run last 60 secs. Can you point me in the direction of any apache/php/linux settings that might give rise to problems when processing multiple images - and end up with broken images. I feel there's still hope for me, if I could just figure what's wrong. Nice work all the same. |
Fatal error: imagecreatetruecolor(): requires GD 2.0 or later in /var/www/html/myphone/forum/attachment.php on line 199
Well, I have to say that $ImageMagick_enabled=1; and my path for imagekick is OK ('/usr/X11R6/bin/'), as I already use it for photopost. So, what's wrong :) |
Now I get strange errors... Somethign changed but I don't know what :)
Code:
<br> |
Quote:
|
Quote:
You have the safemode problem, but give me a link ill look into it directly for you. |
All times are GMT. The time now is 08:03 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|