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

moving assets to azure storage #189

Open
1 task done
carlituxman opened this issue Jul 21, 2023 · 0 comments
Open
1 task done

moving assets to azure storage #189

carlituxman opened this issue Jul 21, 2023 · 0 comments
Labels
help wanted type:enhancement New feature or request.

Comments

@carlituxman
Copy link

carlituxman commented Jul 21, 2023

Is your enhancement related to a problem? Please describe.

I just trying moving uploads folder from existing wordpress to azure storage.
But _wp_attached_file posts has a relative path, then wp attach site url

Then you can force moved previous uploads:

Now:

function windows_azure_storage_wp_get_attachment_url( $url, $post_id ) {
	$media_info = get_post_meta( $post_id, 'windows_azure_storage_info', true );

	if ( ! empty( $media_info ) && isset( $media_info['url'] ) ) {
		return $media_info['url'];
	} else {
		return $url;
	}
}

Designs

No response

Describe alternatives you've considered

function windows_azure_storage_wp_get_attachment_url( $url, $post_id ) {
	$media_info = get_post_meta( $post_id, 'windows_azure_storage_info', true );

	if ( ! empty( $media_info ) && isset( $media_info['url'] ) ) {
		return $media_info['url'];
	} else {
            // **_---> RETURN base_url from AZURE with moved image_**

            if(defined('AZURE_STORAGE_URL'))
            { 
                $upload_file_name = get_post_meta( $post_id, '_wp_attached_file', true );
                return AZURE_STORAGE_URL . $upload_file_name;
            }
            else
            {
                return $url;
            }

	}
}

Code of Conduct

  • I agree to follow this project's Code of Conduct
@carlituxman carlituxman added the type:enhancement New feature or request. label Jul 21, 2023
@jeffpaul jeffpaul added this to the Future Release milestone Jan 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted type:enhancement New feature or request.
Projects
None yet
Development

No branches or pull requests

2 participants