Skip to content

Commit

Permalink
Merge pull request #38 from nguyenanhung/develop
Browse files Browse the repository at this point in the history
fixed img proxy
  • Loading branch information
hungnguyenhp authored Sep 9, 2023
2 parents 0658d7f + 4bb5000 commit 04d7fde
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/BaseHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
*/
class BaseHelper
{
const VERSION = '1.5.2';
const LAST_MODIFIED = '2023-08-10';
const VERSION = '1.5.3';
const LAST_MODIFIED = '2023-09-10';
const PROJECT_NAME = 'CodeIgniter - Basic Helper';
const AUTHOR_NAME = 'Hung Nguyen';
const AUTHOR_FULL_NAME = 'Hung Nguyen';
Expand Down
6 changes: 4 additions & 2 deletions src/ImageHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class ImageHelper extends BaseHelper
/**
* Function googleGadgetsProxy
*
* @param string $url
* @param int $width
* @param string $url
* @param int $width
* @param null|int $height
*
* @return string
Expand All @@ -38,6 +38,7 @@ public static function googleGadgetsProxy($url = '', $width = 100, $height = nul
$proxyUrl = 'https://images1-focus-opensocial.googleusercontent.com/gadgets/proxy';
$proxyContainer = 'focus';
$proxyRefresh = 2592000;
$url = str_replace('media.anhp.vn:8081', 'media.anhp.vn', $url);
$params = array();
$params['url'] = $url;
$params['resize_w'] = $width;
Expand Down Expand Up @@ -78,6 +79,7 @@ public static function googleGadgetsProxyDnsPrefetch()
public static function wordpressProxy($imageUrl = '', $server = 'i3')
{
$imageUrl = str_replace(array('https://', 'http://', '//'), '', $imageUrl);
$imageUrl = str_replace('media.anhp.vn:8081', 'media.anhp.vn', $imageUrl);
$url = 'https://' . trim($server) . '.wp.com/' . $imageUrl;

return trim($url);
Expand Down

0 comments on commit 04d7fde

Please sign in to comment.