Making WordPress.org


Ignore:
Timestamp:
02/23/2016 04:12:32 AM (9 years ago)
Author:
dd32
Message:

Plugins Directory: Implement basic Banner & Icon support (including porting the autotomatically generated icons plugin over) to give plugins a bit of individuality.
See #1584

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-wporg-plugin-directory-tools.php

    r2501 r2555  
    2424
    2525        // Sanitize contributors.
    26         var_dump($data);
    2726        foreach ( $data->contributors as $i => $name ) {
    2827            if ( get_user_by( 'login', $name ) ) {
     
    3837        return $data;
    3938    }
     39
     40    /**
     41     * Retrieve the average color of a specified image.
     42     * This currently relies upon the Jetpack libraries.
     43     *
     44     * @param $file_location string URL or filepath of image
     45     * @return string|bool Average color as a hex value, False on failure
     46     */
     47    static function get_image_average_color( $file_location ) {
     48        if ( ! class_exists( 'Tonesque' ) && function_exists( 'jetpack_require_lib' ) ) {
     49            jetpack_require_lib( 'tonesque' );
     50        }
     51        if ( ! class_exists( 'Tonesque' ) ) {
     52            return false;
     53        }
     54
     55        $tonesque = new Tonesque( $file_location );
     56        if ( $tonesque ) {
     57            return $tonesque->color();
     58        }
     59
     60        return false;
     61    }
    4062}
Note: See TracChangeset for help on using the changeset viewer.