SlideShare uma empresa Scribd logo
1 de 34
Baixar para ler offline
WordCamp Europe 2013 The Netherlands
Perfect Your Images
Using WordPress
Mike Schroder & Marko Heijnen
WordCamp Europe 2013 The Netherlands
Mike Marko
DH-Shredder
@GetSource
Recent rockstar 3.5
WP-CLI contributor
WordPress Core rep
Happy DreamHost Employee
@MarkoHeijnen
Recent rockstar 3.4
GlotPress lead developer
Founder of CodeKitchen
WordCamp Europe 2013 The Netherlands
What was wrong?
WordCamp Europe 2013 The Netherlands
GD was used directly
WordCamp Europe 2013 The Netherlands
Image manipulation abstracted
WordCamp Europe 2013 The Netherlands
WP_Image_Editor
• Centralized way to read an image file
• manipulate it
• save IT
• STREAM IT
WordCamp Europe 2013 The Netherlands
How was it MADE?
WordCamp Europe 2013 The Netherlands
International COOPERATION.
WordCamp Europe 2013 The Netherlands
Gives you the power of core
WordCamp Europe 2013 The Netherlands
GD and Imagick Support
WordCamp Europe 2013 The Netherlands
Imagick has color profiles
WordCamp Europe 2013 The Netherlands
The Difference
GD Imagick
WordCamp Europe 2013 The Netherlands
What’s the catch?
WordCamp Europe 2013 The Netherlands
No more direct image
manipulation
WordCamp Europe 2013 The Netherlands
Deprecated filters
• Image_save_pre is now image_editor_save_pre
• wp_save_image_file is now
wp_save_image_editor_file
• image_edit_before_change is now
wp_image_editor_before_change
WordCamp Europe 2013 The Netherlands
What’s still missing?
Centralized way to read an image attachment from
the database and manage its sizes and properties
WordCamp Europe 2013 The Netherlands
Maybe WP_Image...
https://github.com/markoheijnen/WP_Image
WordCamp Europe 2013 The Netherlands
To load an attachment
No current alternative to load_image_to_edit(), so:
wp_get_image_editor( _load_image_to_edit_path( $post_id ) );
WordCamp Europe 2013 The Netherlands
Okay, what can we do with it?
WordCamp Europe 2013 The Netherlands
• resize( $max_w, $max_h, $crop );
• multi_resize( {
['size'] => {'width', 'height',['crop']}, ...
} );
• crop( $src_x, $src_y, $src_w, $src_h,
$dst_w, $dst_h, $src_abs );
• rotate( $angle );
• flip( $horz, $vert );
• save( $destfilename, $mime_type );
• stream( $mime_type );
The actions
WordCamp Europe 2013 The Netherlands
WordCamp Europe 2013 The Netherlands
A simple resize
// Get instance of WP_Image_Editor selected by WordPress
$editor = wp_get_image_editor( '/path/to/image.png' );
// Returns WP_Error on failure, so check.
if ( ! is_wp_error( $editor ) ) {
// Resize the image with a center crop
$editor->resize( 300, 300, true );
// Uses extension for type, unless optional mime parameter is used.
$editor->save( 'new_image.gif' );
}
WordCamp Europe 2013 The Netherlands
A simple resize
©Massimo Catarinella (CC-SA)
WordCamp Europe 2013 The Netherlands
A simple resize
WordCamp Europe 2013 The Netherlands
Extend to create your own
image-manip engines or
functions.
WordCamp Europe 2013 The Netherlands
Tiff: Image or not?
WordCamp Europe 2013 The Netherlands
You can even extend Imagick
for everyone’s favorite filter:
WordCamp Europe 2013 The Netherlands
Sepia!
WordCamp Europe 2013 The Netherlands
WordCamp Europe 2013 The Netherlands
WordCamp Europe 2013 The Netherlands
Thanks for listening!
Any questions?
@getSource & @markoHeijnen
WordCamp Europe 2013 The Netherlands
• GD: wp-includes/class-wp-image-editor-gd.php
• Imagick: wp-includes/class-wp-image-editor-imagick.php
• Gmagick: http://wordpress.org/extend/plugins/gmagick/
• Improved GD Editor:
http://wordpress.org/plugins/improved-gd-image-editor/
Editor examples
WordCamp Europe 2013 The Netherlands
• http://make.wordpress.org/core/2012/12/06/wp_image_editor-is-
incoming/
• http://markoheijnen.com/wordpress-new-image-manipulation/
• http://xref.wordpress.org/trunk/WordPress/Image_Editor/
WP_Image_Editor.html
More Resources!
WordCamp Europe 2013 The Netherlands
• https://github.com/getsource/imagick-sepia/
• https://github.com/humanmade/WPThumb/
• https://github.com/markoheijnen/gmagick-editor
• https://github.com/markoheijnen/Improved-image-editor
• https://github.com/interconnectit/my-eyes-are-up-here
More Resources!

Mais conteúdo relacionado

Semelhante a Perfect your images using WordPress - WordCamp Europe 2013

CV Alan Brady 2015
CV Alan Brady 2015CV Alan Brady 2015
CV Alan Brady 2015
alan brady
 
WordPress Developers Israel Meetup #1
WordPress Developers Israel Meetup #1WordPress Developers Israel Meetup #1
WordPress Developers Israel Meetup #1
Yoav Farhi
 
Android 2D Drawing and Animation Framework
Android 2D Drawing and Animation FrameworkAndroid 2D Drawing and Animation Framework
Android 2D Drawing and Animation Framework
Jussi Pohjolainen
 

Semelhante a Perfect your images using WordPress - WordCamp Europe 2013 (20)

Image manipulation in WordPress 3.5
Image manipulation in WordPress 3.5Image manipulation in WordPress 3.5
Image manipulation in WordPress 3.5
 
Dealing with media
Dealing with mediaDealing with media
Dealing with media
 
Image Manipulation in WordPress 3.5 - WordCamp Phoenix 2013
Image Manipulation in WordPress 3.5 - WordCamp Phoenix 2013Image Manipulation in WordPress 3.5 - WordCamp Phoenix 2013
Image Manipulation in WordPress 3.5 - WordCamp Phoenix 2013
 
MAKE YOUR THEMES AND PLUGINS READY FOR TRANSLATION
MAKE YOUR THEMES AND PLUGINS READY FOR TRANSLATIONMAKE YOUR THEMES AND PLUGINS READY FOR TRANSLATION
MAKE YOUR THEMES AND PLUGINS READY FOR TRANSLATION
 
Wordpress beyond blogging
Wordpress beyond bloggingWordpress beyond blogging
Wordpress beyond blogging
 
CV Alan Brady 2015
CV Alan Brady 2015CV Alan Brady 2015
CV Alan Brady 2015
 
Static site gen talk
Static site gen talkStatic site gen talk
Static site gen talk
 
Drupal Modules
Drupal ModulesDrupal Modules
Drupal Modules
 
Html 5 mobile - nitty gritty
Html 5 mobile - nitty grittyHtml 5 mobile - nitty gritty
Html 5 mobile - nitty gritty
 
Advanced EPUB creation for iPad with Adobe InDesign CC - Digital Book World 2014
Advanced EPUB creation for iPad with Adobe InDesign CC - Digital Book World 2014Advanced EPUB creation for iPad with Adobe InDesign CC - Digital Book World 2014
Advanced EPUB creation for iPad with Adobe InDesign CC - Digital Book World 2014
 
What is "Domain Driven Design" and what can you expect from it?
What is "Domain Driven Design" and what can you expect from it?What is "Domain Driven Design" and what can you expect from it?
What is "Domain Driven Design" and what can you expect from it?
 
Word press gets responsive 4x3
Word press gets responsive 4x3Word press gets responsive 4x3
Word press gets responsive 4x3
 
Drupal Security: How to survive Drupalgeddon and prepare for future (European...
Drupal Security: How to survive Drupalgeddon and prepare for future (European...Drupal Security: How to survive Drupalgeddon and prepare for future (European...
Drupal Security: How to survive Drupalgeddon and prepare for future (European...
 
Building and Maintaining a Distribution in Drupal 7 with Features
Building and Maintaining a  Distribution in Drupal 7 with FeaturesBuilding and Maintaining a  Distribution in Drupal 7 with Features
Building and Maintaining a Distribution in Drupal 7 with Features
 
WordPress Developers Israel Meetup #1
WordPress Developers Israel Meetup #1WordPress Developers Israel Meetup #1
WordPress Developers Israel Meetup #1
 
How to Project-Manage and Implement a Responsive Website
How to Project-Manage and Implement a Responsive WebsiteHow to Project-Manage and Implement a Responsive Website
How to Project-Manage and Implement a Responsive Website
 
Android 2D Drawing and Animation Framework
Android 2D Drawing and Animation FrameworkAndroid 2D Drawing and Animation Framework
Android 2D Drawing and Animation Framework
 
Wp responsive-theme-framework
Wp responsive-theme-frameworkWp responsive-theme-framework
Wp responsive-theme-framework
 
Convert modules from 6.x to 7.x
Convert modules from 6.x to 7.xConvert modules from 6.x to 7.x
Convert modules from 6.x to 7.x
 
Virtually Anyone
Virtually AnyoneVirtually Anyone
Virtually Anyone
 

Mais de Marko Heijnen

Bootstrapping your plugin
Bootstrapping your pluginBootstrapping your plugin
Bootstrapping your plugin
Marko Heijnen
 

Mais de Marko Heijnen (20)

Custom coded projects
Custom coded projectsCustom coded projects
Custom coded projects
 
Security, more important than ever!
Security, more important than ever!Security, more important than ever!
Security, more important than ever!
 
My Contributor Story
My Contributor StoryMy Contributor Story
My Contributor Story
 
WooCommerce & Apple TV
WooCommerce & Apple TVWooCommerce & Apple TV
WooCommerce & Apple TV
 
The moment my site got hacked - WordCamp Sofia
The moment my site got hacked - WordCamp SofiaThe moment my site got hacked - WordCamp Sofia
The moment my site got hacked - WordCamp Sofia
 
Mijn site beveiliging
Mijn site beveiligingMijn site beveiliging
Mijn site beveiliging
 
The moment my site got hacked
The moment my site got hackedThe moment my site got hacked
The moment my site got hacked
 
My complicated WordPress site
My complicated WordPress siteMy complicated WordPress site
My complicated WordPress site
 
Node.js to the rescue
Node.js to the rescueNode.js to the rescue
Node.js to the rescue
 
Protecting your site by detection
Protecting your site by detectionProtecting your site by detection
Protecting your site by detection
 
GlotPress aka translate.wordpress.org
GlotPress aka translate.wordpress.orgGlotPress aka translate.wordpress.org
GlotPress aka translate.wordpress.org
 
Writing clean and maintainable code
Writing clean and maintainable codeWriting clean and maintainable code
Writing clean and maintainable code
 
Extending WordPress as a pro
Extending WordPress as a proExtending WordPress as a pro
Extending WordPress as a pro
 
Let's create a multilingual site in WordPress
Let's create a multilingual site in WordPressLet's create a multilingual site in WordPress
Let's create a multilingual site in WordPress
 
Bootstrapping your plugin
Bootstrapping your pluginBootstrapping your plugin
Bootstrapping your plugin
 
The development and future of GlotPress
The development and future of GlotPressThe development and future of GlotPress
The development and future of GlotPress
 
Why Javascript matters
Why Javascript mattersWhy Javascript matters
Why Javascript matters
 
The code history of WordPress
The code history of WordPressThe code history of WordPress
The code history of WordPress
 
Building plugins like a pro
Building plugins like a proBuilding plugins like a pro
Building plugins like a pro
 
The awesome things you can do with images inside WordPress
The awesome things you can do with images inside WordPressThe awesome things you can do with images inside WordPress
The awesome things you can do with images inside WordPress
 

Último

Último (20)

Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 

Perfect your images using WordPress - WordCamp Europe 2013

  • 1. WordCamp Europe 2013 The Netherlands Perfect Your Images Using WordPress Mike Schroder & Marko Heijnen
  • 2. WordCamp Europe 2013 The Netherlands Mike Marko DH-Shredder @GetSource Recent rockstar 3.5 WP-CLI contributor WordPress Core rep Happy DreamHost Employee @MarkoHeijnen Recent rockstar 3.4 GlotPress lead developer Founder of CodeKitchen
  • 3. WordCamp Europe 2013 The Netherlands What was wrong?
  • 4. WordCamp Europe 2013 The Netherlands GD was used directly
  • 5. WordCamp Europe 2013 The Netherlands Image manipulation abstracted
  • 6. WordCamp Europe 2013 The Netherlands WP_Image_Editor • Centralized way to read an image file • manipulate it • save IT • STREAM IT
  • 7. WordCamp Europe 2013 The Netherlands How was it MADE?
  • 8. WordCamp Europe 2013 The Netherlands International COOPERATION.
  • 9. WordCamp Europe 2013 The Netherlands Gives you the power of core
  • 10. WordCamp Europe 2013 The Netherlands GD and Imagick Support
  • 11. WordCamp Europe 2013 The Netherlands Imagick has color profiles
  • 12. WordCamp Europe 2013 The Netherlands The Difference GD Imagick
  • 13. WordCamp Europe 2013 The Netherlands What’s the catch?
  • 14. WordCamp Europe 2013 The Netherlands No more direct image manipulation
  • 15. WordCamp Europe 2013 The Netherlands Deprecated filters • Image_save_pre is now image_editor_save_pre • wp_save_image_file is now wp_save_image_editor_file • image_edit_before_change is now wp_image_editor_before_change
  • 16. WordCamp Europe 2013 The Netherlands What’s still missing? Centralized way to read an image attachment from the database and manage its sizes and properties
  • 17. WordCamp Europe 2013 The Netherlands Maybe WP_Image... https://github.com/markoheijnen/WP_Image
  • 18. WordCamp Europe 2013 The Netherlands To load an attachment No current alternative to load_image_to_edit(), so: wp_get_image_editor( _load_image_to_edit_path( $post_id ) );
  • 19. WordCamp Europe 2013 The Netherlands Okay, what can we do with it?
  • 20. WordCamp Europe 2013 The Netherlands • resize( $max_w, $max_h, $crop ); • multi_resize( { ['size'] => {'width', 'height',['crop']}, ... } ); • crop( $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs ); • rotate( $angle ); • flip( $horz, $vert ); • save( $destfilename, $mime_type ); • stream( $mime_type ); The actions
  • 21. WordCamp Europe 2013 The Netherlands
  • 22. WordCamp Europe 2013 The Netherlands A simple resize // Get instance of WP_Image_Editor selected by WordPress $editor = wp_get_image_editor( '/path/to/image.png' ); // Returns WP_Error on failure, so check. if ( ! is_wp_error( $editor ) ) { // Resize the image with a center crop $editor->resize( 300, 300, true ); // Uses extension for type, unless optional mime parameter is used. $editor->save( 'new_image.gif' ); }
  • 23. WordCamp Europe 2013 The Netherlands A simple resize ©Massimo Catarinella (CC-SA)
  • 24. WordCamp Europe 2013 The Netherlands A simple resize
  • 25. WordCamp Europe 2013 The Netherlands Extend to create your own image-manip engines or functions.
  • 26. WordCamp Europe 2013 The Netherlands Tiff: Image or not?
  • 27. WordCamp Europe 2013 The Netherlands You can even extend Imagick for everyone’s favorite filter:
  • 28. WordCamp Europe 2013 The Netherlands Sepia!
  • 29. WordCamp Europe 2013 The Netherlands
  • 30. WordCamp Europe 2013 The Netherlands
  • 31. WordCamp Europe 2013 The Netherlands Thanks for listening! Any questions? @getSource & @markoHeijnen
  • 32. WordCamp Europe 2013 The Netherlands • GD: wp-includes/class-wp-image-editor-gd.php • Imagick: wp-includes/class-wp-image-editor-imagick.php • Gmagick: http://wordpress.org/extend/plugins/gmagick/ • Improved GD Editor: http://wordpress.org/plugins/improved-gd-image-editor/ Editor examples
  • 33. WordCamp Europe 2013 The Netherlands • http://make.wordpress.org/core/2012/12/06/wp_image_editor-is- incoming/ • http://markoheijnen.com/wordpress-new-image-manipulation/ • http://xref.wordpress.org/trunk/WordPress/Image_Editor/ WP_Image_Editor.html More Resources!
  • 34. WordCamp Europe 2013 The Netherlands • https://github.com/getsource/imagick-sepia/ • https://github.com/humanmade/WPThumb/ • https://github.com/markoheijnen/gmagick-editor • https://github.com/markoheijnen/Improved-image-editor • https://github.com/interconnectit/my-eyes-are-up-here More Resources!