The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Auto Resize Image Attachments (Avatars & Profile Pic Too).... Details »» | |||||||||||||||||||||||||||
Auto Resize Image Attachments (Avatars & Profile Pic Too)....
Developer Last Online: Oct 2010
Gone
Show Your Support
|
Comments |
#52
|
||||
|
||||
Excellent hack! *clicks install* Does exactly what is says on the tin :-)
Just a quick question tho, do the 'original' large files automatically get deleted off the server or do we have to do that manually? Also a note for people using the attachment resizer, you have to 'increase' the sizes in your ACP to let the larger files get uploaded to then be resized. :-) |
#53
|
||||
|
||||
Sometimes the images shown (JPG) are a bit dark... anyway to get them lighter? :-/
Most users wont know how to conver to gif, so thats not any option really... |
#54
|
||||
|
||||
Uploaded all as per instructions,doesn't seem to be working
Do you need safe mode turned off for this to work... Uploaded the 2 hacks,no errors or anything but doesn't work :ermm: Edit: Got the avatar hack working,slight problem same as another user, the pic is slightly darker |
#55
|
|||
|
|||
Thanks for that wiked hack
|
#56
|
|||
|
|||
anyone know if you can intergrate this into vb gallery?
|
#57
|
|||
|
|||
Excellent hack.
I see a couple of small problems with it though:
I've fixed these problems, and also did some code cleanup. You can uncomment error_log() lines and change email to your actual address to get some idea how this hack performs. Code:
// HACK: auto resize uploaded images switch ($imginfo[2]) { case 1: $im = ImageCreateFromGIF($attachment); break; case 2: $im = ImageCreateFromJPEG($attachment); break; case 3: $im = ImageCreateFromPNG($attachment); break; // no way to handle these image types default: // error_log("Couldn't resize $attachment ($filesize bytes)", 1, "email@yourdomain.net"); @unlink($attachment); eval('$error = "' . fetch_phrase('attachbaddimensions', PHRASETYPEID_ERROR) . '";'); $errors[] = array( 'filename' => $attachment_name, 'error' => $error ); return false; } $w = $imginfo[0]; $h = $imginfo[1]; $width_factor = $w / $maxattachwidth; $height_factor = $h / $maxattachheight; if ($width_factor > $height_factor) { $nw = round($w / $wdth_factor); $nh = round($h / $wdth_factor); } else { $nw = round($w / $height_factor); $nh = round($h / $height_factor); } $ni = @ImageCreateTrueColor($nw, $nh); if ($ni OR !@ImageCopyResampled($ni, $im, 0, 0, 0, 0, $nw, $nh, $w, $h)) { // failed to resize this image // error_log("Couldn't resize $attachment ${w}x${h} to ${nw}x${nh} ($filesize bytes)", 1, "email@yourdomain.net"); @unlink($attachment); eval('$error = "' . fetch_phrase('attachbaddimensions', PHRASETYPEID_ERROR) . '";'); $errors[] = array( 'filename' => $attachment_name, 'error' => $error ); return false; } @ImageDestroy($im); if (PHP_VERSION != '4.3.2' AND $vboptions['attachthumbs'] == 2) { require_once('./includes/functions_image.php'); UnsharpMask($ni); } switch ($imginfo[2]) { case 1: @ImageGIF($ni, $attachment); break; case 2: @ImageJPEG($ni, $attachment, 70); break; case 3: @ImagePNG($ni, $attachment); break; } @ImageDestroy($ni); $filesize1 = @filesize($attachment); // error_log("Resized $attachment ${w}x${h} to ${nw}x${nh} ($filesize to ${filesize1})", 1, "email@yourdomain.net"); $filesize = $filesize1; // /HACK |
#58
|
|||
|
|||
kmike,
nice fixes. has anyone tested this yet on 3.5 RC2? |
#59
|
|||
|
|||
I am getting this error when attempting the Profile Pic modification:
Fatal error: Call to undefined function: unsharpmask() in /home/website/forums/includes/functions_upload.php on line 294 EDIT: Nevermind added require_once('./includes/functions_image.php'); and it works! |
#60
|
|||
|
|||
Can this one please be ported to vB3.5?
|
#61
|
|||
|
|||
A port to 3.5 would be VERY useful.
|
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|