Skip to content

Instantly share code, notes, and snippets.

@micahwave
Created February 7, 2012 17:38
Show Gist options
  • Save micahwave/1760940 to your computer and use it in GitHub Desktop.
Save micahwave/1760940 to your computer and use it in GitHub Desktop.
set_thumbnail
$tmp = download_url( $url );
$img = basename( $url );
$info = pathinfo( $img );
$ext = isset( $info['extension'] ) ? '.' . $info['extension'] : '.jpg';
preg_match( '/[^\?]+\.(jpg|JPG|jpe|JPE|jpeg|JPEG|gif|GIF|png|PNG|tmp)/', $tmp, $matches );
//$file_array['name'] = basename( $matches[0] );
$file_array['name'] = str_replace( '.tmp', $ext, basename( $matches[0] ) );
$file_array['tmp_name'] = $tmp;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment