Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Photon: Use wp_get_upload_dir #6038

Merged
merged 1 commit into from
Jan 30, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions class.photon.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public static function filter_the_content( $content ) {
$content_width = Jetpack::get_content_width();

$image_sizes = self::image_sizes();
$upload_dir = wp_upload_dir();
$upload_dir = wp_get_upload_dir();

foreach ( $images[0] as $index => $tag ) {
// Default to resize, though fit may be used in certain cases where a dimension cannot be ascertained
Expand Down Expand Up @@ -605,7 +605,7 @@ public function filter_image_downsize( $image, $attachment_id, $size ) {
* @return array An array of Photon image urls and widths.
*/
public function filter_srcset_array( $sources, $size_array, $image_src, $image_meta ) {
$upload_dir = wp_upload_dir();
$upload_dir = wp_get_upload_dir();

foreach ( $sources as $i => $source ) {
if ( ! self::validate_image_url( $source['url'] ) ) {
Expand Down Expand Up @@ -841,7 +841,7 @@ protected static function strip_image_dimensions_maybe( $src ){
// Build URL, first removing WP's resized string so we pass the original image to Photon
if ( preg_match( '#(-\d+x\d+)\.(' . implode('|', self::$extensions ) . '){1}$#i', $src, $src_parts ) ) {
$stripped_src = str_replace( $src_parts[1], '', $src );
$upload_dir = wp_upload_dir();
$upload_dir = wp_get_upload_dir();

// Extracts the file path to the image minus the base url
$file_path = substr( $stripped_src, strlen ( $upload_dir['baseurl'] ) );
Expand Down