vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 4.x Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=245)
-   -   Miscellaneous Hacks - Smush.it Attachment & Avatar (https://vborg.vbsupport.ru/showthread.php?t=275542)

EXIDE 12-14-2011 11:00 PM

Smush.it Attachment & Avatar
 
1 Attachment(s)
This sends your image attachments and avatars to smush.it for compression, if the image can be compressed it will download the newly compressed one and replace the attachment or avatar with it.

If you would like features added to it or you find any bugs or problems please let me know.

ACP->Settings->Options->Smush.it Attachment & Avatar Options

[Requirements]
You need to be using PHP 5.2.0 or greater.
You must be storing attachments and avatars in the filesystem.


3.8.x Version: https://vborg.vbsupport.ru/showthread.php?t=275577

http://www.smushit.com/ysmush.it/

[Updates]
16/12/11:
Fixed settings options not being added.

30/12/11:
Added option to smush user uploaded avatars.
Smarter way of fetching avatars and attachments.

24/3/12:
Added TABLE_PREFIX to install and uninstall code.
Fixed typo in uninstall code.

Remember to select "Allow Overwrite" when importing the product.

dothanhtrung 12-16-2011 01:11 AM

can you make for 3.8.x

EXIDE 12-16-2011 05:26 PM

Quote:

Originally Posted by dothanhtrung (Post 2278182)
can you make for 3.8.x

Done.
https://vborg.vbsupport.ru/showthread.php?t=275577

Alfa1 12-17-2011 02:33 AM

Awesome! I was waiting for this.

Sage Knight 12-17-2011 04:22 AM

ooh <3

Is it possible to compress forum avatars?

dothanhtrung 12-17-2011 03:33 PM

Quote:

Originally Posted by EXIDE (Post 2278374)

thank you very much:up:

Alecsmith 12-18-2011 11:46 AM

Excellent mod tagged for now :D

klaus 12-20-2011 11:05 PM

How do I know if it is working and/or what percentage the image got compressed.

I have a similar plugin in Wordpress and love it.

A future addition would be the ability to re-smush attachments already in the forum. Attachments that got uploaded prior to this plugin.

Alfa1 12-21-2011 07:33 AM

Quote:

Originally Posted by klaus (Post 2279569)
A future addition would be the ability to re-smush attachments already in the forum. Attachments that got uploaded prior to this plugin.

That would make a world of difference.

Disasterpiece 12-21-2011 09:20 AM

This messes up my error_reporting setting... Could you change it to this?

PHP Code:

            $err_old error_reporting(0);
            
            if (
file_exists($sattachment['attachment_folder_id']))
            {
...
            }
            
            
error_reporting($err_old); 

Did this by myself but maybe you might want to include this in the next update, since it's more generic and respects the administrator's own settings.

@see http://de3.php.net/manual/en/functio...-reporting.php

EXIDE 12-22-2011 07:55 PM

Quote:

Originally Posted by klaus (Post 2279569)
How do I know if it is working and/or what percentage the image got compressed.

I have a similar plugin in Wordpress and love it.

A future addition would be the ability to re-smush attachments already in the forum. Attachments that got uploaded prior to this plugin.

At the moment you can check the image size by admincp or checking the attachment file directly, I'm also planning to add some stats data to the attachments displaybits.

Currently working on giving people the option to re-smush attachments at the moment, I expect to update this mod in the next 2-3 days.

Quote:

Originally Posted by Disasterpiece (Post 2279661)
This messes up my error_reporting setting... Could you change it to this?

PHP Code:

            $err_old error_reporting(0);
            
            if (
file_exists($sattachment['attachment_folder_id']))
            {
...
            }
            
            
error_reporting($err_old); 

Did this by myself but maybe you might want to include this in the next update, since it's more generic and respects the administrator's own settings.

@see http://de3.php.net/manual/en/functio...-reporting.php

I don't plan too make this modifcation compatible with other mods at the moment, but your free to make that change for yourself. Although the next version will not require to disable error_reporting.

Also if you want to get the current error_reporting level for the script just remove the "0" from the function. As your way disables error_reporting for the rest of the script.

final kaoss 12-22-2011 10:53 PM

It would be nice if it could smush all incoming avatars as well

OldSchoolDSL 12-23-2011 01:41 AM

Quote:

Originally Posted by extreme-gaming (Post 2280221)
It would be nice if it could smush all incoming avatars as well

I like this opinion. But it would have to have the option to turn that feature on or off. Some communities allow or have people who use animated GIF files and sadly, Yahoo's Smush It can and sometimes does remove that animation in its optimization process.

edit: Would it be possible for this to have the option to skip over GIF files?

EXIDE 12-30-2011 06:31 PM

Quote:

Originally Posted by OldSchoolDSL (Post 2280262)
I like this opinion. But it would have to have the option to turn that feature on or off. Some communities allow or have people who use animated GIF files and sadly, Yahoo's Smush It can and sometimes does remove that animation in its optimization process.

edit: Would it be possible for this to have the option to skip over GIF files?

Both features added, 3.8.x version updated aswell, next update will include the ability to smush already uploaded avatars and attachments.

billrini 03-23-2012 09:06 PM

It looks like the script does not use the table prefix. My tables are vb_* I get the error:

ALTER TABLE `filedata` ADD `smushed` VARCHAR( 3 ) NOT NULL DEFAULT 'no';

Any chance you could update this to use the table prefix? I can do it myself but I would imagine others are going to run into this same issue and it seems like it would reduce a lot of posts from people saying, "It won't install" :-)

EXIDE 03-24-2012 01:10 AM

Quote:

Originally Posted by billrini (Post 2312623)
It looks like the script does not use the table prefix. My tables are vb_* I get the error:

ALTER TABLE `filedata` ADD `smushed` VARCHAR( 3 ) NOT NULL DEFAULT 'no';

Any chance you could update this to use the table prefix? I can do it myself but I would imagine others are going to run into this same issue and it seems like it would reduce a lot of posts from people saying, "It won't install" :-)

Thanks for pointing that out, completely looked over those sections.

Theres also a typo in the uninstall code, you will need to change the first line from:
PHP Code:

$db->query_read("ALTER TABLE " TABLE_PREFIX "filedata DROP smushed;"

To this:
PHP Code:

$db->query_read("ALTER TABLE " TABLE_PREFIX "filedata DROP smushed"); 

Everyone else can do those edits manually or upload version 1.1 and allow it to overwrite.

Big-K 05-11-2012 11:06 AM

i got this error
Quote:

Database error in vBulletin 4.1.12:

Invalid SQL:
ALTER TABLE vb4_`filedata` ADD `smushed` VARCHAR( 3 ) NOT NULL DEFAULT 'no';

MySQL Error : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '`filedata` ADD `smushed` VARCHAR( 3 ) NOT NULL DEFAULT 'no'' at line 1
Error Number : 1064
Request Date : Friday, May 11th 2012 @ 07:59:27 AM
Error Date : Friday, May 11th 2012 @ 07:59:30 AM
Script : http://www.xxxx.com/forum/admincp/ad...=productimport
Referrer : http://www.xxxx.com/forum/admincp/pl...?do=productadd
IP Address : 99.72.92.220
Username : admin
Classname : vB_Database_MySQLi
MySQL Version : 5.1.62-cll

EXIDE 05-11-2012 10:55 PM

Uploaded a new one, please download and verify the problem is gone.

TundraSoul 07-22-2012 12:11 AM

Is there anyway to smush attachments that are already in the file system? One at a time is fine from the attachment menu in the control panel would be fine.

EXIDE 07-22-2012 12:48 AM

Quote:

Originally Posted by TundraSoul (Post 2350287)
Is there anyway to smush attachments that are already in the file system? One at a time is fine from the attachment menu in the control panel would be fine.

Currently no you can't, but I will start again on this mod tomorrow and give you the following options to smush existing images.
  • New page in admin panel listing non-smushed images.
  • Cronjob to smush 1 image every x minutes.

klaus 12-05-2012 06:11 PM

1 Attachment(s)
I like the idea of this plug in. I use it but have zero way to verify if it works and how much images get compressed. I use a similar plugin for wordpress and I get good feedback from it.

The WP plug in also lets you do a Bulk image compression against all images in the library.

scottct1 12-07-2012 02:38 PM

I installed this yesterday and when people go to upload files they get a message

Warning: mkdir() [function.mkdir]: Permission denied in [path]/newattachment.php(344) : eval()'d code on line 7

Warning rmdir ([path]/tmp/smush1369) [function.rmdir]: No such file or directory in [path]/newattachment.php(344_ : eval()'d code on line 74.

Which directory is it trying to write to and what permissions are needed for that directory? if I disable the plugin things upload fine.

Thanks!

delinetci 12-18-2012 12:39 PM

error removing

https://vborg.vbsupport.ru/external/2013/07/14.jpg

final kaoss 01-24-2013 05:58 PM

He posted the fix for uninstalling or did you apply that already?

scottct1 02-01-2013 02:40 PM

Quote:

Originally Posted by scottct1 (Post 2389100)
I installed this yesterday and when people go to upload files they get a message

Warning: mkdir() [function.mkdir]: Permission denied in [path]/newattachment.php(344) : eval()'d code on line 7

Warning rmdir ([path]/tmp/smush1369) [function.rmdir]: No such file or directory in [path]/newattachment.php(344_ : eval()'d code on line 74.

Which directory is it trying to write to and what permissions are needed for that directory? if I disable the plugin things upload fine.

Thanks!

Anyone have any ideas on this one? I would love to get this working.

Xexiu 05-13-2013 06:55 PM

Quote:

Originally Posted by scottct1 (Post 2401060)
Anyone have any ideas on this one? I would love to get this working.

I have the same problem!! I made a folder on "/var/www/tmp_smush" and gived 777 permissions but still the same problem:


Code:

Warning: mkdir(): Permission denied in [path]/newattachment.php(552) : eval()'d code on line 7

Warning: rmdir([path]/tmp_smush1724): No such file or directory in [path]/newattachment.php(552) : eval()'d code on line 72

Any fix/clues?

final kaoss 07-21-2013 06:49 PM

Well you see what that error message is trying to tell you? It's saying that it can't find the table "smushed". If that's the case, try adding a table named "smushed" and see if it helps.
Quote:

Originally Posted by bankcroft (Post 2434716)
I have the same problem, and I have the newest version.
Right now, I just want to uninstall the plugin.


final kaoss 07-22-2013 12:00 AM

Good call there, does adding the 'forumdb.vb_filedata' help with anything?

EXIDE 07-25-2013 02:06 AM

Sorry about the troubles this is giving you guys at the moment but I am working on a new version now that I have time, this will be better supported and contain less bugs.

V2 features:
  • AdminCP page listing all image attachments with the current smush status. (file size, compression ratio, bytes saved).
  • AdminCP page listing all avatars (Users and pre-uploaded) with the current smush status. (file size, compression ratio, bytes saved).
  • Cronjob running every 10 minutes updating 1 image attachment and 1 avatar at a time. (PHP timeout are generaly 30 seconds, each smush can take around 15-20 seconds).
  • Option to re-smush attachments.

I hope to have this updated by saturday latest.

Justinphx 07-25-2013 03:23 AM

Sounds great. I look forward to checking it out.

jimsflies 02-20-2014 01:18 AM

Does this work with 4.2.2? Or can it be updated to work?

I installed but get an error when uploading an attachment...I get a pop up that has this on it:

Code:

The following errors occurred:

<p>Database Error</p>


ozzy47 02-20-2014 01:21 AM

Check your server error logs for the error, or perhaps the email you set up in config.php to get technical emails.

jimsflies 02-20-2014 10:41 AM

Here's the error:

Code:

                        SELECT attachment.*, filedata.*
                        FROM vb_attachment
                        LEFT JOIN vb_filedata AS filedata ON (attachment.filedataid = filedata.filedataid)
                        WHERE posthash = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';

MySQL Error  : Unknown table 'attachment'

I see there is some discussion about database prefixes, it does have the prefix in the FROM line.

Kolbi 04-01-2014 10:04 AM

Can someone confirm it on vB 4.2.2?

jimsflies 04-01-2014 11:43 AM

I did get it to work on 4.2.2 after paying to have it fixed. However, for some odd reason, the images do not show up on Internet Explorer...they did work on other browsers. Not sure if anyone else has seen this issue with images processed by smush.it?


All times are GMT. The time now is 06:02 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01434 seconds
  • Memory Usage 1,830KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (3)bbcode_code_printable
  • (4)bbcode_php_printable
  • (13)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (35)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete