WordPress.org

Forums

Import External Images
Add https and ignore case in URI (2 posts)

  1. Will Mayall
    Member
    Posted 3 years ago #

    The plugin is terrific - thanks!

    I suggest that you add https and ignore case in URIs.

    A simple change for https.

    Old:

    preg_match( '/^http:\/\//' , $uri )

    New:

    preg_match( '/^https?:\/\//i' , $uri )

    There are lots of ways to ignore case in the extension. The following rewrites the code a bit and adds jpeg.

    Old:

    if ( $path_parts['extension'] == 'gif' || $path_parts['extension'] == 'jpg' || $path_parts['extension'] == 'png' )
      $result[] = $uri;

    New:

    $extensions = array ( 'gif', 'jpg', 'jpeg', 'png' );
    if ( in_array ( strtolower ( $path_parts['extension'] ), $extensions ) )
      $result[] = $uri;

    http://wordpress.org/extend/plugins/import-external-images/

  2. bugaonz
    Member
    Posted 3 years ago #

    Thanks Will Mayall!

    I'm facing the problem with https today and you are my hero!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Import External Images
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.