QQWorld Auto Save Images - Version 1.7.12.6

Version Description

Download this release

Release Info

Developer qqworld
Plugin Icon 128x128 QQWorld Auto Save Images
Version 1.7.12.6
Comparing to
See all releases

Code changes from version 1.7.12.5 to 1.7.12.6

Files changed (1) hide show
  1. qqworld-auto-save-images.php +8 -7
qqworld-auto-save-images.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: QQWorld Auto Save Images
4
  Plugin URI: https://wordpress.org/plugins/qqworld-auto-save-images/
5
  Description: Automatically keep the all remote picture to the local, and automatically set featured image.
6
- Version: 1.7.12.5
7
  Author: Michael Wang
8
  Author URI: http://www.qqworld.org
9
  Text Domain: qqworld_auto_save_images
@@ -1188,8 +1188,13 @@ class QQWorld_auto_save_images {
1188
  }
1189
 
1190
  public function download_image($image_url) {
 
 
 
 
 
1191
  // curl
1192
- if (function_exists('curl_init')) {
1193
  $ch = curl_init();
1194
  $timeout = 5;
1195
  curl_setopt($ch, CURLOPT_URL, $image_url);
@@ -1198,7 +1203,7 @@ class QQWorld_auto_save_images {
1198
  curl_close($ch);
1199
  }
1200
  // GD
1201
- if (!$file && function_exists('fsockopen')) {
1202
  $type = $this->fsockopen_image_header($image_url);
1203
  if ($type && in_array($type, array('image/jpeg', 'image/gif', 'image/png'))) {
1204
  $type = substr($type, 6);
@@ -1210,10 +1215,6 @@ class QQWorld_auto_save_images {
1210
  imagedestroy($img);
1211
  } else $file = '';
1212
  }
1213
- // file_get_contents
1214
- if (!$file && function_exists('file_get_contents')) {
1215
- $file = @file_get_contents($image_url);
1216
- }
1217
  return $file;
1218
  }
1219
 
3
  Plugin Name: QQWorld Auto Save Images
4
  Plugin URI: https://wordpress.org/plugins/qqworld-auto-save-images/
5
  Description: Automatically keep the all remote picture to the local, and automatically set featured image.
6
+ Version: 1.7.12.6
7
  Author: Michael Wang
8
  Author URI: http://www.qqworld.org
9
  Text Domain: qqworld_auto_save_images
1188
  }
1189
 
1190
  public function download_image($image_url) {
1191
+ $file = '';
1192
+ // file_get_contents
1193
+ if (function_exists('file_get_contents')) {
1194
+ $file = @file_get_contents($image_url);
1195
+ }
1196
  // curl
1197
+ if (empty($file) && function_exists('curl_init')) {
1198
  $ch = curl_init();
1199
  $timeout = 5;
1200
  curl_setopt($ch, CURLOPT_URL, $image_url);
1203
  curl_close($ch);
1204
  }
1205
  // GD
1206
+ if (empty($file) && function_exists('fsockopen')) {
1207
  $type = $this->fsockopen_image_header($image_url);
1208
  if ($type && in_array($type, array('image/jpeg', 'image/gif', 'image/png'))) {
1209
  $type = substr($type, 6);
1215
  imagedestroy($img);
1216
  } else $file = '';
1217
  }
 
 
 
 
1218
  return $file;
1219
  }
1220