This repository has been archived by the owner on Aug 23, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbedev-imagemagick.php
89 lines (72 loc) · 2.29 KB
/
bedev-imagemagick.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
/*
* Plugin Name: BeDeViouS ImageMagick
* Plugin URI: TBC
* Description: WordPress plugin allowing users to edit images on the front end using the ImageMagick Library
* Author: BeDevious Web Development
* Version: 0.0.1
* Author URI: http://www.bedevious.co.uk
* License: GPL2+
* Text Domain: bedev-imagemagick
* Domain Path: TBC
*/
/**
*
* Load all of the plugin files
*
**/
include_once( 'lib/script-style-loader.php' );
include_once( 'lib/front-end.php' );
include_once( 'lib/ajax-handlers.php' );
include_once( 'lib/class-bedev-imagemagick.php' );
include_once( 'lib/class-bedev-imagemagick-options.php' );
include_once( 'lib/seo-overrides.php' );
/**
*
* Add options into the DB
*
* Placeholder until admin options page is created
*
**/
$bedev_registered_soical_sites = array(
'facebook' => array(
'app_id' => 'YOUR_FACEBOOK_APP_ID',
'montage-overlay' => 6126,
'image-dimensions' => array( 'width' => 1200 , 'height' => 628 ),
),
'twitter' => array(
'app_id' => 'N/A',
'montage-overlay' => 6148,
'image-dimensions' => array( 'width' => 1024 , 'height' => 512 ),
),
'instagram' => array(
'app_id' => 'N/A',
'montage-overlay' => 6146,
'image-dimensions' => array( 'width' => 1080 , 'height' => 1080 ),
),
);
$options = array(
'montage-images' => array( 718 , 719 ), //the IDs of the two images to use in the montage
'front-end-path' => 'https://www.example.com/', //the path to the page that you are using for the front end editor
'description' => 'My desciption', //the description to use when sharing a link
'bedev_registered_social_sites' => $bedev_registered_soical_sites, //the sites that the admin wants to offer users to share images on
);
update_option( 'bedev-imagemagick-options' , $options );
/**
*
* Re-add ImageMagick Defauilt for WordPress
*
* Specifically to override default to GD by Force Regenerate Thumbnails and use bedev_image_magick to extend functionality
*
* @since 0.0.1
*
**/
function bedev_readd_imagemagick( $image_editors ) {
$imagemagick_ref = 'WP_Image_Editor_Imagick';
if( !in_array( $imagemagick_ref , $image_editors ) ) {
array_unshift( $image_editors , $imagemagick_ref );
}
$image_editors = array( 'bedev_image_magick', 'WP_Image_Editor_GD' );
return $image_editors;
}
add_filter( 'wp_image_editors', 'bedev_readd_imagemagick' , 20 );