[wp-trac] [WordPress Trac] #31050: Better PDF Upload Management

WordPress Trac noreply at wordpress.org
Sun Feb 7 17:33:33 UTC 2016


#31050: Better PDF Upload Management
------------------------------------+-----------------------------
 Reporter:  celloexpressions        |       Owner:
     Type:  feature request         |      Status:  new
 Priority:  normal                  |   Milestone:  Future Release
Component:  Media                   |     Version:
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |     Focuses:
------------------------------------+-----------------------------

Comment (by pbearne):

 Replying to [comment:18 markoheijnen]:

 > - What to do about Video/Audio image?
 [https://core.trac.wordpress.org/attachment/ticket/31050/31050.3.patch
 31050.3.patch] removes the logic added in #23673

 I had a similar problem where I needed the image for a video the way I
 solved it was to get the open graph data saved the image provided there.

 {{{#!php
 <?php
         /**
          * http://stackoverflow.com/questions/2068344/how-do-i-get-a
 -youtube-video-thumbnail-from-the-youtube-api
          *
          * @param $url
          *
          * @return string
          */
         private static function get_open_graph_data_for_url(
                 $url
         ) {
                 if ( empty( esc_url( $url ) ) ) {
                         return '';
                 }
                 $transit_id  = 'LP-open-graph-data';
                 $transit_key = md5( $url );

                 $open_graph_data = get_transient( $transit_id );

                 if ( false === $open_graph_data || ! isset(
 $open_graph_data[ $transit_key ] ) ) {
                         try {
                                 $scraper                         = new
 SimpleScraper( esc_url( $url ) );
                                 $open_graph_data[ $transit_key ] =
 $scraper->getOgp();

                                 set_transient( $transit_id,
 $open_graph_data, HOUR_IN_SECONDS );
                         } catch ( Exception $e ) {
                                 error_log( 'Caught SimpleScrape exception:
 ' . $e->getMessage() );

                                 return false;
                         }


                 }

                 return $open_graph_data[ $transit_key ];
         }
 }}}
 I used the lib
 {{{
 /*
 +---------------------------------------------------------------------------+
  | Simple Scraper (SimpleScraper.class.php )
 |
  | Copyright (c) 2013-2015, Ramon Kayo
 |
 +---------------------------------------------------------------------------+
  | Author        : Ramon Kayo
 |
  | Email         : contato at ramonkayo.com
 |
  | License       : Distributed under the MIT License
 |
  | Full license  : http://code.ramonkayo.com/simple-scraper/license.txt
 |
 +---------------------------------------------------------------------------+
  | "Simplicity is the ultimate sophistication." - Leonardo Da Vinci
 |
 +---------------------------------------------------------------------------+
  | Last modified : 2015-07-08
 |
 +---------------------------------------------------------------------------+
  */
 }}}

 Just a throught

 Paul

--
Ticket URL: <https://core.trac.wordpress.org/ticket/31050#comment:19>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list