Home
Download
Add-ons
Help
Forum
Organisation
Project
Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
May 24, 2012, 07:53:04 PM
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search:
Advanced search
Interested in joining the WebsiteBaker team?
For more Information read
here
or on our
new website
.
155467
Posts in
21707
Topics by
7732
Members
Latest Member:
DarrellDD
WebsiteBaker Community Forum
English
Droplets (PHP code for use with Droplet module) & Snippets (raw PHP code)
(Moderator:
Argos
)
imageOptimizer
Pages: [
1
]
Go Down
Author
Topic: imageOptimizer (Read 4171 times)
Ralf (Berlin)
Offline
Posts: 1314
imageOptimizer
«
on:
November 23, 2008, 07:06:46 AM »
imageOptimizer parse the
page_content()
and replaces all images which are resized only by the <img> attributes
height
and
width
with a new, physically adapted image.
I have wrote this tool because of the experience that most editors/writers take there images directly from any digital camera and bring them with help of TinyMCE or FCKEditor a.s.o to the wished format - which results in a horrible page performance for the visitors...
imageOptimizer supports JPG, GIF and PNG (also with transparency), reduce traffic and spends your visitors fast loading and lightweight pages
Requirements
PHP 5.2.x
need the WB Addon dbConnect (attached)
Setup
After installing
dbConnect
and
imageOptimizer
edit the template(s) of your site and replace
page_content();
with the following code:
Code:
if (class_exists('imageOptimizer')) {
ob_start();
page_content();
$content = ob_get_contents();
ob_end_clean();
image_optimize($content);
}
else {
page_content();
}
imageOptimizer register all images of your website in a database and dont change any original images. If a image should be resized/optimized imageOptimizer create a new image, place it in his directory /MEDIA/optimized_images and replace the original image with the new one. By the next call to this page imageOptimizer uses directly the image from his directory.
Known Limits / Issues
missing configuration interface (phpMyAdmin only)
at the moment you can not exclude complete pages from parsing
imageOptimizer does not remove no longer needed files
is not tested with the various image galleries, may be there will be occur some difficulties
missing some statistic informations
...
imageOptimizer is still ALPHA but fully functionally and I use it with best results at
panke.info
.
Please test it, report me any problem and make suggestions for improvements.
Regards
Ralf
-- Attached files removed, please look a newer post --
«
Last Edit: November 24, 2008, 08:29:46 PM by Ralf (Berlin)
»
Logged
marathoner
Offline
Posts: 495
Re: imageOptimizer
«
Reply #1 on:
November 23, 2008, 05:43:37 PM »
Wow...great idea! Something that should already be available in the the WYSIWYG editors! I'll test soon.
Logged
Ralf (Berlin)
Offline
Posts: 1314
Re: imageOptimizer
«
Reply #2 on:
November 24, 2008, 05:06:35 AM »
Quote
Wow...great idea!
Thank you
Quote
Something that should already be available in the the WYSIWYG editors!
I think it's the best way to parse page_content() because you will get the output of all modules (wysiwyg, news, manual a.s.o) and not only of one editor.
Regards
Ralf
Logged
Ralf (Berlin)
Offline
Posts: 1314
Re: imageOptimizer
«
Reply #3 on:
November 24, 2008, 08:28:02 PM »
Hello,
here is release 0.11 of imageOptimizer, with the following changes:
Bugfix: if <img> has no attributes for width and height imageOptimizer set image size to zero
Bugfix: imageOptimizer ignored percentual values for width and height
Added: imageOptimizer rewrite now the values for <img> attributes width and height if neccessary
Codecleanings, added comments
Error reports and suggestions for improvements welcome!
Regards
Ralf
-- Attached files removed, please look a newer post --
«
Last Edit: November 27, 2008, 08:46:29 PM by Ralf (Berlin)
»
Logged
Ralf (Berlin)
Offline
Posts: 1314
Re: imageOptimizer
«
Reply #4 on:
November 27, 2008, 08:41:50 PM »
Hello,
release 0.12 of imageOptimizer is ready, with the following changes:
added: configuration control dialog
added: option to switch debugging mode on/off
added: option to encrease memory usage if necessary
changed php requirements to php 5.x
Important:
The
initializing method for imageOptimizer has changed
, please use this code in your template:
Code:
if (class_exists('imageOptimizer')) {
ob_start();
page_content();
$content = ob_get_contents();
ob_end_clean();
image_optimize($page_id, $content);
}
else {
page_content();
}
Because imageOptimizer is a
code snippet
there exists no access to the configuration via backend. To access the configuration dialog create a new page of type code and insert the following code:
Code:
if (class_exists('imageOptimizerControl')) {
image_optimizer_control($page_id);
}
else {
echo "imageOptimizerControl not found!";
}
You should hide this page an give access only for yourself - anyway imageOptimizer check if the accessing user is logged in and member of the group administrators otherwise imageOptimizer denies access.
Requirements:
PHP 5.x
need the WB addon dbConnect (attached)
need the WB addon rhTools (attached)
Error reports an suggestions for improvements welcome!
Regards
Ralf
«
Last Edit: December 11, 2008, 08:59:22 AM by Ralf (Berlin)
»
Logged
Argos
Moderator
Offline
Posts: 2156
Re: imageOptimizer
«
Reply #5 on:
November 29, 2008, 01:15:04 AM »
Very nice and welcome function!! I can't wait for my new server in January, that has PHP5. Must do with PHP4 for a little time...
Logged
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
WB Showcase:
http://www.mywebsitebaker.com/pages/showcase.php?v&category_id=1242&count=30
----------------------------------------------------------------
Please don't request personal support, use the forums!
Ralf (Berlin)
Offline
Posts: 1314
Re: imageOptimizer
«
Reply #6 on:
November 29, 2008, 05:08:18 AM »
Quote
Very nice and welcome function!!
Thank you
Quote
I can't wait for my new server in January, that has PHP5. Must do with PHP4 for a little time...
There is absolutly no chance to get imageOptimizer working with PHP4 ...
Regards
Ralf
Logged
Ralf (Berlin)
Offline
Posts: 1314
Re: imageOptimizer
«
Reply #7 on:
November 30, 2008, 11:13:07 AM »
Hello,
Release 0.13 of imageOptimizer is ready.
This version is complete and should be the last beta if there are no errors...
This release add a control center with statistic informations and tools. The statistic informations are very helpful to see how effective the imageOptimizer work and how much
traffic
you are saving - the tools help you to keep the imageOptimizer up to date.
You need to upgrade the attached
dbConnect
and
rhTools
before upgrading the imageOptimizer.
Regards
Ralf
«
Last Edit: December 11, 2008, 08:59:05 AM by Ralf (Berlin)
»
Logged
Ralf (Berlin)
Offline
Posts: 1314
Re: imageOptimizer
«
Reply #8 on:
November 30, 2008, 07:27:03 PM »
panke.info is a local portal, where everyone who is allowed to publish articles take his own images directly from his digital camera an place it within the articles. The following statistic screenshot shows, how effective the imageOptimizer is working:
There is nothing sugarcoated or so...
Regards
Ralf
Logged
Argos
Moderator
Offline
Posts: 2156
Re: imageOptimizer
«
Reply #9 on:
November 30, 2008, 07:47:47 PM »
Quote from: Ralf (Berlin) on November 30, 2008, 07:27:03 PM
panke.info is a local portal, where everyone who is allowed to publish articles take his own images directly from his digital camera an place it within the articles.
Hi Ralf,
what are the image settings you use on panke.info? I only see a lot of very large images...
Logged
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
WB Showcase:
http://www.mywebsitebaker.com/pages/showcase.php?v&category_id=1242&count=30
----------------------------------------------------------------
Please don't request personal support, use the forums!
Ralf (Berlin)
Offline
Posts: 1314
Re: imageOptimizer
«
Reply #10 on:
November 30, 2008, 08:02:32 PM »
Hello Argos,
Quote
what are the image settings you use on panke.info? I only see a lot of very large images...
There are also with use of the imageOptimizer some large images (i.e. at the start pages of the sub portals) - imageOptimizer dont touch images which are not resized...
Which pages/images do you mean exactly?
Edit:
Ah, I have detect what you mean: it seem that the imageOptimizer have a problem with some images, for example at
Flussbeschreibungen
- at this page are optimized images but also a big, not optimized image:
D1%20Lietzengraben%20CS.jpg
. I must check the reason for this behaviour - perhaps the whitespaces...
Regards
Ralf
«
Last Edit: November 30, 2008, 08:08:49 PM by Ralf (Berlin)
»
Logged
Argos
Moderator
Offline
Posts: 2156
Re: imageOptimizer
«
Reply #11 on:
November 30, 2008, 08:05:20 PM »
I only visited the section "Fotografien":
http://panke.info/pages/fotografien/der-verlauf-der-panke.php?dir13=
Logged
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
WB Showcase:
http://www.mywebsitebaker.com/pages/showcase.php?v&category_id=1242&count=30
----------------------------------------------------------------
Please don't request personal support, use the forums!
Ralf (Berlin)
Offline
Posts: 1314
Re: imageOptimizer
«
Reply #12 on:
November 30, 2008, 08:36:02 PM »
Quote
I only visited the section "Fotografien":
http://panke.info/pages/fotografien/der-verlauf-der-panke.php?dir13=
ok - this image is a png with transparency and big, but the imageOptimizer dont touch it...
Quote
Edit: Ah, I have detect what you mean: it seem that the imageOptimizer have a problem with some images, for example at Flussbeschreibungen - at this page are optimized images but also a big, not optimized image: D1%20Lietzengraben%20CS.jpg. I must check the reason for this behaviour - perhaps the whitespaces...
This problem seems to be caused by the ownership of this image (was not accessible for the imageOptimizer).
Regards
Ralf
Logged
Argos
Moderator
Offline
Posts: 2156
Re: imageOptimizer
«
Reply #13 on:
November 30, 2008, 09:02:17 PM »
Quote from: Ralf (Berlin) on November 30, 2008, 08:36:02 PM
Quote
I only visited the section "Fotografien":
http://panke.info/pages/fotografien/der-verlauf-der-panke.php?dir13=
ok - this image is a png with transparency and big, but the imageOptimizer dont touch it...
No no sorry, I didn't mean the single image on that page, but the complete galleries there under.
Logged
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
WB Showcase:
http://www.mywebsitebaker.com/pages/showcase.php?v&category_id=1242&count=30
----------------------------------------------------------------
Please don't request personal support, use the forums!
Ralf (Berlin)
Offline
Posts: 1314
Re: imageOptimizer
«
Reply #14 on:
December 01, 2008, 05:04:16 AM »
Quote
No no sorry, I didn't mean the single image on that page, but the complete galleries there under.
Indeed the imageOptimizer should be able to optimze these pictures - at the moment I have no idea why it does not work there...
Regards
Ralf
Logged
Ralf (Berlin)
Offline
Posts: 1314
Re: imageOptimizer
«
Reply #15 on:
December 01, 2008, 08:27:02 PM »
Quote from: Argos on November 30, 2008, 09:02:17 PM
No no sorry, I didn't mean the single image on that page, but the complete galleries there under.
This problem is fixed - it was a problem with whitespaces within the image names. Please check panke.info again, hope you will not find any other problems
Regards
Ralf
Logged
Argos
Moderator
Offline
Posts: 2156
Re: imageOptimizer
«
Reply #16 on:
December 01, 2008, 08:51:31 PM »
Seems to work now
Great snippet!
Logged
Jurgen Nijhuis
Argos Media
Heiloo, The Netherlands
WB Showcase:
http://www.mywebsitebaker.com/pages/showcase.php?v&category_id=1242&count=30
----------------------------------------------------------------
Please don't request personal support, use the forums!
Ralf (Berlin)
Offline
Posts: 1314
Re: imageOptimizer
«
Reply #17 on:
December 11, 2008, 09:30:04 AM »
Hello,
I've just released
imageOptimizer 0.15
(
stable
).
added
: "babble mode" insert a small info bar at the end of each page to show how many images are optimized and how many traffic is saved (may be switched on/off)
fixed
: encoding spaces within filenames
Download:
imageOptimizer
Requirements:
imageOptimizer needs at minimum PHP 5.x, installed
rhTools 0.41
and
dbConnect 0.29
After installing dbConnect, rhTools and imageOptimizer please edit the template of your website and replace
page_content();
with:
Code:
if (class_exists('imageOptimizer')) {
ob_start();
page_content();
$content = ob_get_contents();
ob_end_clean();
image_optimize($page_id, $content);
}
else {
page_content();
}
Because the imageOptimizer is a snippet you dont have access to it by the backend. To get access to the administration of the imageOptimizer please create a new
private
page of type
code
and insert the following code:
Code:
if (class_exists('imageOptimizerControl')) {
image_optimizer_control($page_id);
}
else {
echo "imageOptimizerControl is not installed!";
}
The following screenshot shows the "babble mode":
This screenshot shows how effective the imageOptimizer is working at
panke.info
:
All error reports an suggestions for improvements are always welcome!
Regards
Ralf
«
Last Edit: December 11, 2008, 11:53:39 AM by Ralf (Berlin)
»
Logged
Ralf (Berlin)
Offline
Posts: 1314
Re: imageOptimizer
«
Reply #18 on:
December 14, 2008, 05:53:07 PM »
Hello,
I've just released
imageOptimizer 0.18 (stable)
.
0.18 - 2008-12-14 (STABLE)
* fixed: ignored error while getting image size
* fixed: try to optimize images outside the own webspace
* fixed: debugging mode was true by default
* added: switch to turn imageOptimizer on/off
0.17 - 2008-12-13 (STABLE)
* added: check for the MySQL version
* changed: changed datatypes for compatibility with MySQL 4.x
0.16 - 2008-12-11 (STABLE)
* fixed: problem with umlauts within the title and/or alt tags
Download:
imageOptimizer
Regards
Ralf
Logged
xso
Offline
Posts: 4
Re: imageOptimizer breaks two other modules
«
Reply #19 on:
March 01, 2009, 04:54:31 PM »
After installing imageOptimizer two other modules do not work anymore:
Contactlist (
http://www.websitebakers.com/pages/modules/listings/various/contactlist.php
) gives the message blow:
Fatal error: Cannot redeclare editadressbackend() (previously declared in C:\xampp\htdocs\modules\contactlist\functions.php:35) in C:\xampp\htdocs\modules\contactlist\functions.php on line 260
and
GDpics (
http://www.websitebakers.com/pages/modules/image-galleries/gdpics-image-gallery.php?searchresult=1&sstring=gdpics
)
gives only blank pages.
Uninstalling ImageOptimizer makes them working again.
regards,
Rinse
Logged
Pages: [
1
]
Go Up
Jump to:
Please select a destination:
-----------------------------
General
-----------------------------
=> General Announcements
=> Security Announcements
=> Documentation
=> WebsiteBaker Website Showcase
=> Guest Area & Off-Topic
-----------------------------
English
-----------------------------
=> WebsiteBaker 2.9
===> Announcements
===> Help/Support
=====> Modules / Extensions
===> Suggestions
===> Software bugs
=> Help & Support
=> Modules
=> Droplets (PHP code for use with Droplet module) & Snippets (raw PHP code)
=> jQuery
=> Templates, Menus & Design
=> WebsiteBaker Language Files
=> WebsiteBaker 2.x discussion
=> WebsiteBaker 3
=> Archive (posts up to 2007)
-----------------------------
Deutsch (German)
-----------------------------
=> Ankündigungen
=> WebsiteBaker 2.9
===> Ankündigungen
===> Hilfe/Support
=====> Module / Extensions
===> Vorschläge
===> Softwarefehler
===> Erfahrungs und Testberichte
=> Hilfe/Support
=> Module & Snippets
=> Templates & Design
=> Tutorials
=> jQuery
=> Diskussion über WB
=> Off-Topic
=> Archiv für Themen bis 2007
-----------------------------
Nederlands (Dutch)
-----------------------------
=> Aankondigingen
=> Hulp & Ondersteuning
=> Niet-Terzake (Off Topic)
-----------------------------
Francais (French)
-----------------------------
=> Help/Support
-----------------------------
Italiano (Italian)
-----------------------------
=> Help/Support
-----------------------------
Bakery (WB shop module)
-----------------------------
=> Bakery English
=> Bakery Deutsch
-----------------------------
KeepInTouch (Multi Contact Module)
-----------------------------
=> KeepInTouch English
=> KeepInTouch Deutsch
Loading...