Skip to content

Instantly share code, notes, and snippets.

View jbma's full-sized avatar

Jean-Baptiste Marchand-Arvier jbma

View GitHub Profile
@jbma
jbma / webp-gif.php
Created November 13, 2019 14:27
WebP Gif
<?php
function no_webp_for_gif( $response, $process, $file, $thumb_size, $optimization_level, $webp, $is_disabled ) {
if ( ! $webp || $is_disabled || is_wp_error( $response ) ) {
return $response;
}
if ( 'image/gif' !== $file->get_mime_type() ) {
return $response;
}
@jbma
jbma / exclude.php
Last active January 15, 2018 15:31
<?php
function __imagify_exclude($attachment_id){
if (in_array(23, 34,439)){
return false;
}
return true;
}
add_filter( 'imagify_auto_optimize_attachment', '__imagify_exclude' );
<?php
require('wp-load.php');
echo '<pre>;
print_r(wp_remote_get("https://app.imagify.io/api/version"));
<?php
add_action( 'admin_init', '__remove_imagify_notice' )
function __remove_imagify_notice() {
remove_filter( 'admin_notices', '_imagify_rocket_notice' );
}
<?php
$im = Imagify_Attachment($id);
$im->optimize();
<?php
add_action( 'admin_init', 'imagify_only_admin' );
function imagify_only_admin(){
if (current_user_can('administrator')){
remove_filter( 'manage_media_columns', '_imagify_manage_media_custom_column' );
remove_filter( 'manage_media_columns', '_imagify_manage_media_columns' );
remove_filter( 'attachment_fields_to_edit', '_imagify_attachment_fields_to_edit');
remove_filter( 'media_row_actions', '_imagify_add_actions_to_media_list_row');
}
<?php
function __imagify_bulk(){
return 1;
}
add_filter( 'imagify_bulk_buffer_size', '__imagify_bulk' );
<?php
function add_image_insert_override($sizes){
unset( $sizes['thumbnail_1']);
unset( $sizes['large']);
return $sizes;
}
add_filter('intermediate_image_sizes_advanced', 'add_image_insert_override' );
ssl_certificate /etc/letsencrypt/live/{{url}}/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/{{url}}/privkey.pem;
@jbma
jbma / taks.yml
Created September 29, 2016 19:03
---
- name: download certbot
get_url: url=https://dl.eff.org/certbot-auto dest=/tmp/
- name: Chmod Certbot
command: chmod a+x certbot-auto chdir=/tmp
- name: Generate the certificates
command: ./certbot-auto certonly --standalone --agree-tos -m [email protected] -n -d {{item}} chdir=/tmp