Giter Club home page Giter Club logo

windows-azure-storage's Introduction

Microsoft Azure Storage for WordPress

Use the Microsoft Azure Storage service to host your website's media files.

Support Level Release Version WordPress tested up to version BSD 2-Clause License

Description

This WordPress plugin allows you to use Microsoft Azure Storage Service to host your media and uploads for your WordPress powered website. Microsoft Azure Storage is an effective way to infinitely scale storage of your site and leverage Azure's global infrastructure.

For more details on Microsoft Azure Storage, please visit the Microsoft Azure website.

For more details on configuring a Microsoft Azure Storage account and on using the plugin with the Block Editor or Classic Editor, please visit the user guide.

Requirements

  • PHP 8.0+ (For PHP 7.4 support you need to use 4.3.5)
  • WordPress 5.7+

Installation

  1. Upload the plugin files to the /wp-content/plugins/windows-azure-storage directory, or install the plugin through the WordPress plugins screen directly.
  2. Activate the plugin through the 'Plugins' screen in WordPress.
  3. Use the Settings->Microsoft Azure screen to configure the plugin.

For multisites or to enforce Azure Blob Storage settings, you can define the following constants in wp-config.php:

  • MICROSOFT_AZURE_ACCOUNT_NAME - Account Name
  • MICROSOFT_AZURE_ACCOUNT_KEY - Account Primary Access Key
  • MICROSOFT_AZURE_CONTAINER - Azure Blob Container
  • MICROSOFT_AZURE_CNAME - Domain: must start with http(s)://
  • MICROSOFT_AZURE_USE_FOR_DEFAULT_UPLOAD - boolean (default false)

See Settings->Microsoft Azure for more information.

Upgrade Notice

3.0.0

This release features several security fixes and enhancements. It is highly recommended that all users upgrade immediately.

Support Level

Stable: 10up is not planning to develop any new features for this, but will still respond to bug reports and security concerns. We welcome PRs, but any that include new features should be small and easy to integrate and should not include breaking changes. We otherwise intend to keep this tested up to the most recent version of WordPress.

Known Issues

Storage Account Versions

Storage accounts can be created via CLI, classic Azure portal, or the new Azure portal, with varying results.

If a Storage account is created with the new Azure portal, authentication will fail, resulting in the inability to view/add containers or files. Creating a Storage account with the Azure CLI should allow the plugin to work with new Storage accounts.

Responsive Images in WordPress 4.4

Images uploaded to the Azure Storage service will not automatically receive responsive versions. Images added through the WordPress Media Loader should get automatically converted to responsive images when inserted into a post or page. We are investigating options for full support of responsive images in the plugin.

Media Library Editor

Media editing tools are currently not working. The edited images are not uploaded to Azure Storage. Will be fixed in future releases.

Azure Storage Account Migration

At the moment, changing the Azure Storage account (and blob URLs) requires to manually update data in the WordPress database.

Data should be updated in these tables:

  1. wp_options (or wp-config.php or Settings > Microsoft Azure): plugin settings
  2. wp_posts:
  • links in post_content of pages and posts (rows with post_type = page or post)
  • guid of rows with post_type = attachment
  1. wp_postmeta: meta_value of rows with meta_key = _wp_attachment_metadata or windows_azure_storage_info

Note: data in wp_postmeta is PHP serialized, it cannot be updated with simple search-and-replace. There are multiple ways to do it:

  1. Using WP-CLI, detailed instructions here.
  2. Directly inside WordPress, using the Better Search Replace plugin.
  3. Using an external tool that supports PHP serialization, like Search Replace DB.

Changelog

A complete listing of all notable changes to Microsoft Azure Storage are documented in CHANGELOG.md.

Contributing

Please read CODE_OF_CONDUCT.md for details on our code of conduct, CONTRIBUTING.md for details on the process for submitting pull requests to us, and CREDITS.md for a listing of maintainers of, contributors to, and libraries used by Microsoft Azure Storage.

Like what you see?

windows-azure-storage's People

Contributors

640-kb avatar allan23 avatar barneyjeffries avatar cadic avatar clorith avatar colegeissinger avatar debabratakarfa avatar dependabot[bot] avatar dkotter avatar elliott-stocks avatar eugene-manuilov avatar helen avatar iamdharmesh avatar jaywood avatar jeffpaul avatar johnwatkins0 avatar kopepasah avatar lukaspawlik avatar morganestes avatar oscarssanchez avatar peterwilsoncc avatar psorensen avatar radeno avatar rickalee avatar ritesh-patel avatar sidsector9 avatar stevegrunwell avatar superpowered avatar thrijith avatar tott avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

windows-azure-storage's Issues

EWWW Bulk optimise

Describe the bug
EWWW Bulk optimisation feature allows to re run optimisation on the entire media library. Both plugins have support for each other, I can see that in de code base.
When running bulk optimise the images are not pushed back to Azure. When a new image is uploaded this works as expected.

I'm using the latest version available from wordpress.org https://wordpress.org/plugins/windows-azure-storage/ v 4.1.1

Expected behavior
Optimised images are pushed back to Azure

Environment information

  • Plugins and version: v4.1.1

Upload failure

A new issue has recently appeared - when uploading a new image, I get this error:

Warning: array_flip() expects parameter 1 to be array, object given in /app/public/mods/mu-plugins/windows-azure-storage/includes/class-windows-azure-rest-api-client.php on line 1166

While I get a URL for the image from azure, it returns a 404.

Solution for migrating existing media files

I was in need of a way to migrate a very large media library (more than 40k media files) to blob storage.
I love your plugin but it was lacking a way to handle existing media content. So I have created a wordpress plugin as a companion plugin to this one. It allows existing sites to migrate there existing media files to the blob storage using this plugins functions.

I have not published the plugin yet but wanted to reach out first about the possibility of integrating it into this plugin.

You can view my repo at Microsoft Azure Storage Migration for WordPress

If this is not a feature you are interesting adding to the existing plugin I will proceed with getting it published.

The plugin I have written checks first that your plugin is installed and active as it is using your function to move the files.

Thumbnails/resized images aren't generating

Normally during an upload, the larger image is scaled and uploaded alongside the original.

This was fine as of December;
image

As of January, it's only uploading the original. Considering there hasn't been a major release since November -- not sure what the cause is! Thought I don't think I updated it until late December.

Regenerate Thumbnails using the Regen Thumbnails plugin doesn't work due to it not "finding" the source file. I'm going to try the Wordpress CLI now.

Browse azure storage does display media files

Browse azure storage does not display media files. But you try to search something and clear the search media files are displayed. If you refresh the page and click Add media from azure storage it again displays no files

Media library – Adding a mere 20mb image shoots DB CPU to 90%

Ajax call is made to check the process of the upload and this call just keeps firing to infinity, there by increasing the CPU of the DB. Wordpress version 4.9.8.

Also adding a mere 20mb image shoots DB CPU to 90%.
Below slow query is generated several times only for one image upload.

SELECT cms_posts.ID
FROM cms_posts
WHERE 1=1 AND (((cms_posts.post_title LIKE ‘%https://ticketcms.azureedge.net/ticketcms/2019/05/IMG\\_4C700BD34A96-1-360×180.jpeg%’) OR
(cms_posts.post_excerpt LIKE ‘%https://ticketcms.azureedge.net/ticketcms/2019/05/IMG\\_4C700BD34A96-1-360×180.jpeg%’) OR
(cms_posts.post_content LIKE ‘%https://ticketcms.azureedge.net/ticketcms/2019/05/IMG\\_4C700BD34A96-1-360×180.jpeg%’))) AND
cms_posts.post_type IN (‘post’, ‘page’, ‘attachment’, ‘freetext_template’, ‘featured_event’, ‘static_event_design’, ‘topic_text’, ‘topic_img’, ‘rakuten_banner’, ‘hot_words’, ‘notice’) AND (cms_posts.post_status = ‘publish’ OR cms_posts.post_status = ‘acf-disabled’ OR cms_posts.post_status = ‘future’ OR cms_posts.post_status = ‘draft’ OR cms_posts.post_status = ‘pending’ OR cms_posts.post_author = 1 AND cms_posts.post_status = ‘private’)
ORDER BY cms_posts.post_title LIKE ‘%https://ticketcms.azureedge.net/ticketcms/2019/05/IMG\\_4C700BD34A96-1-360×180.jpeg%’ DESC,
cms_posts.post_date DESC;

Any suggestion would be greatly appreciated.

Adding support for Azure CDN

Hi team,
is that possible to add support for Azure CDN with an azure storage account ?
Storing content ( images/videos) on azure blob is very good but I could also configure CDN with blob storage I will save a lot of time... Loading storage from Blob only is very time consuming and make the ,page loading very long

Continous integrating using Azure Storage plugin

When uploading image to storage, the plug-in creates a DB record in wp_postmeta named "windows_azure_storage_info" for each image.

The value of this record contains hard-coded URL reference to the blob storage (in addition to the wp_options settings for Azure Storage blob's URL).

Given this practice, it is unclear how to implement a CI/CD pipeline without having to change database values that fit different environments in wp_postmeta tables.

clarification: data which resides in wp_options table is exportable as JSON using WP_CFM plugin, meaning no Database changes have to take place between environments.

Overwritten file with same name

Hello,

I think i have found critical bug with this plugin. Our client uploads a lot of files to WP site which are stored on Azure Storage.

When client uploaded file with same file name within same path then file is overwritten.

For example 2019/06/2.jpg and after some days (in same month) is uploaded another file with same name then original file is overwritten.
Original Wordpress implementation checks if file exists and then append number suffix (-1, -2, -3, -4, etc)

I think this Azure storage implementation doesn't check for existing files. Does it?

This is very ugly issue.

readme updates

  • add support level section & badge
  • add license badge
  • move changelog to its own file

Allow settings for Azure to be defined in wp-config.php rather than in database

When dynamically setting the Azure Storage locations when creating new sites, it is helpful to be able to hard-code these things (like the storage key, storage account name, and container name) in wp-config.php rather than as options in the database. There are also big security benefits of doing this as an attacker can't get access to a WordPress admin user and change where uploads serve from, which would allow them to serve malicious files from a location they control. Many other plugins that link WP to an object storage systems use this method to set the variables, such as https://github.com/humanmade/S3-Uploads.

Release 4.2.0

Hello,

any chance to publish version 4.2 early ?

In master is very necessary fix for uploading files with unicode naming, not just ASCII.
And version 4.2 brings very handy settings by constants, very nice feature for containerised deployment.

Files aren't saved to Azure Storage

Describe the bug
Uploading files seems to succeed, but they are not present in the Azure Storage account

Steps to Reproduce

  1. Upload a file through the Media Library
  2. Look in the storage account for the file

Expected behavior
File should be present in Azure Storage

Environment information
WP running as Azure Web App

Additional context
I have tried all different methods of creating the storage. The plugin is able to connect, even to create new containers from the settings.

Admin ajax infinite loop on action "get-azure-progress"

Hi

After the async upload call is processed an ajax call is made to check the process of the upload.
This call just keeps firing to infinity, I tested this on my current project and in a plain Wordpress installation, in both installs that call is fired to infinity.

The only difference I'm noticing between my production app and the plain Wordpress install is the response of the call.

My production app: always keeps hanging on 87% progress

{success: true, data: {progress: 87, current: 7, total: 8}} data : {progress: 87, current: 7, total: 8} current : 7 progress : 87 total : 8 success : true

En the plain install keeps returning -1

{success: true, data: {progress: -1, current: -1, total: -1}} data : {progress: -1, current: -1, total: -1} current : -1 progress : -1 total : -1 success : true

Besides that going on, the upload succeeds as expected. But something seems a bit off here.

If more info is required please let me know and I see if I can gather that info.

Joren

MICROSOFT AZURE STORAGE PLUGIN FOR WORDPRESS

Hi I have version of wordpress 4.9.8.. I installed azure storage for wordpress plugin, and files are uploading to Azure storage, but they are not displaying in media - there I have only blank file.
Add Media from Azure button is not working at all. Any clues?

Uploaded files have a bad Blob type, a bad Content Type and don't upload fully

Describe your question
When creating a post with images, the images do not upload fully.

Looking at them in the Microsoft Azure Storage Explorer, I note three oddities differing from what I see if I use the Storage Explorer to upload those same images.

  1. The Blob Type is Append Blob rather than Block Blob.
  2. The Content Type is text/plain rather than image/jpeg
  3. The file size is 0 rather than the correct size

Please note that I amusing version 4.1.0 of the plug-in since, as several users have noted, version 4.3 simply does not work at all.

Given that MASE uploads correctly, I'm not sure what to do.

Any help would be greatly appreciated.

TIA.

Http error when attempting to upload media (Wordpress)

Hi,

Memory Usage and I/O Usage for my Wordpress based website are constantly being maxed. Memory Usage will typically spike when I upload an image or publish a new post or edit a newly published post, and this causes the website to crash and return a 500 Internal Error. Sometimes I am able to upload a few images. Website is on shared hosting GoDaddy. This is really annoying. I called hosting support and they said that this is happening because my web is attacking :D and they want me to buy their product. They are just salesman and they don't have an idea about technical stuff.

I changed wp-config.php file and define( 'WP_MAX_MEMORY_LIMIT', '256M' );
didn't work, I changed PHP version same bugs... I added php.ini didn't help at all....
Nothing works.

Moreover, I am not sure if this issue is related to the other one, but all of the logo slider plugins I tried to use on the website are not working. They not sliding. Here is my website https://www.sdcc-usa.org.

The most frustrating issue for me is
Please, guys, help me!!!

Attempting to use `WP_Error` object as an array

On WordPress 4.6.0, running the latest version of the feature/azure-plugin-rewrite-v4 branch, I'm getting the following error when trying to upload from wp-admin/media-new.php:

[29-Aug-2016 19:52:31 UTC] PHP Fatal error:  Cannot use object of type WP_Error as array in /srv/www/{CLIENT}/htdocs/wp-content/plugins/windows-azure-storage/includes/class-windows-azure-helper.php on line 413

Full error_log for the request, including artificial stack-trace added just before the return in Windows_Azure_Helper::get_unique_blob_name():

[29-Aug-2016 19:52:30 UTC] PHP Notice:  add_utility_page is <strong>deprecated</strong> since version 4.5.0! Use add_menu_page() instead. in /srv/www/{CLIENT}/htdocs/wp-includes/functions.php on line 3706
[29-Aug-2016 19:52:30 UTC] PHP Warning:  array_flip() expects parameter 1 to be array, object given in /srv/www/{CLIENT}/htdocs/wp-content/plugins/windows-azure-storage/includes/class-windows-azure-rest-api-client.php on line 1167
[29-Aug-2016 19:52:30 UTC] PHP Warning:  array_flip() expects parameter 1 to be array, object given in /srv/www/{CLIENT}/htdocs/wp-content/plugins/windows-azure-storage/includes/class-windows-azure-rest-api-client.php on line 1167
[29-Aug-2016 19:52:31 UTC] PHP Warning:  array_flip() expects parameter 1 to be array, object given in /srv/www/{CLIENT}/htdocs/wp-content/plugins/windows-azure-storage/includes/class-windows-azure-rest-api-client.php on line 1167
[29-Aug-2016 19:52:31 UTC] PHP Warning:  array_flip() expects parameter 1 to be array, object given in /srv/www/{CLIENT}/htdocs/wp-content/plugins/windows-azure-storage/includes/class-windows-azure-rest-api-client.php on line 1167
[29-Aug-2016 19:52:31 UTC] Array
(
    [0] => Array
        (
            [file] => /srv/www/{CLIENT}/htdocs/wp-content/plugins/windows-azure-storage/includes/class-windows-azure-helper.php
            [line] => 411
            [function] => sanitize_blobs_names
            [class] => Windows_Azure_Rest_Api_Client
            [object] => Windows_Azure_Rest_Api_Client Object
                (
                    [_account_name:protected] => 10updeveloper
                    [_access_key:protected] => +mtM8I7dqygfRtXJNjkZIFmB1oPNwTjYnkrmDrHwUDIEHFJiQv+hgt9s/olQRH5YWJB74pnC1ux1Lq872u8lyw==
                    [_current_url:protected] => 
                    [_signature_headers:protected] => Array
                        (
                            [0] => Content-Encoding
                            [1] => Content-Language
                            [2] => Content-Length
                            [3] => Content-MD5
                            [4] => Content-Type
                            [5] => Date
                            [6] => If-Modified-Since
                            [7] => If-Match
                            [8] => If-None-Match
                            [9] => If-Unmodified-Since
                            [10] => Range
                        )

                )

            [type] => ->
            [args] => Array
                (
                    [0] => ncmedia
                    [1] => Array
                        (
                            [2016/08/Screen Shot 2016-08-29 at 11.58.46 AM.png] => Array
                                (
                                    [2016/08/Screen Shot 2016-08-29 at 11.58.46 AM.png] => 2016/08/Screen Shot 2016-08-29 at 11.58.46 AM.png
                                )

                        )

                )

        )

    [1] => Array
        (
            [file] => /srv/www/{CLIENT}/htdocs/wp-content/plugins/windows-azure-storage/windows-azure-storage.php
            [line] => 521
            [function] => get_unique_blob_name
            [class] => Windows_Azure_Helper
            [type] => ::
            [args] => Array
                (
                    [0] => ncmedia
                    [1] => 2016/08/Screen Shot 2016-08-29 at 11.58.46 AM.png
                )

        )

    [2] => Array
        (
            [function] => windows_azure_storage_wp_handle_upload_prefilter
            [args] => Array
                (
                    [0] => Array
                        (
                            [name] => Screen Shot 2016-08-29 at 11.58.46 AM.png
                            [type] => image/png
                            [tmp_name] => /tmp/phpOATbcM
                            [error] => 0
                            [size] => 87232
                        )

                )

        )

    [3] => Array
        (
            [file] => /srv/www/{CLIENT}/htdocs/wp-includes/plugin.php
            [line] => 235
            [function] => call_user_func_array
            [args] => Array
                (
                    [0] => windows_azure_storage_wp_handle_upload_prefilter
                    [1] => Array
                        (
                            [0] => Array
                                (
                                    [name] => Screen Shot 2016-08-29 at 11.58.46 AM.png
                                    [type] => image/png
                                    [tmp_name] => /tmp/phpOATbcM
                                    [error] => 0
                                    [size] => 87232
                                )

                        )

                )

        )

    [4] => Array
        (
            [file] => /srv/www/{CLIENT}/htdocs/wp-admin/includes/file.php
            [line] => 263
            [function] => apply_filters
            [args] => Array
                (
                    [0] => wp_handle_upload_prefilter
                    [1] => Array
                        (
                            [name] => Screen Shot 2016-08-29 at 11.58.46 AM.png
                            [type] => image/png
                            [tmp_name] => /tmp/phpOATbcM
                            [error] => 0
                            [size] => 87232
                        )

                )

        )

    [5] => Array
        (
            [file] => /srv/www/{CLIENT}/htdocs/wp-admin/includes/file.php
            [line] => 449
            [function] => _wp_handle_upload
            [args] => Array
                (
                    [0] => Array
                        (
                            [name] => Screen Shot 2016-08-29 at 11.58.46 AM.png
                            [type] => image/png
                            [tmp_name] => /tmp/phpOATbcM
                            [error] => 0
                            [size] => 87232
                        )

                    [1] => Array
                        (
                            [test_form] => 
                        )

                    [2] => 2016-08-29 12:52:30
                    [3] => wp_handle_upload
                )

        )

    [6] => Array
        (
            [file] => /srv/www/{CLIENT}/htdocs/wp-admin/includes/media.php
            [line] => 282
            [function] => wp_handle_upload
            [args] => Array
                (
                    [0] => Array
                        (
                            [name] => Screen Shot 2016-08-29 at 11.58.46 AM.png
                            [type] => image/png
                            [tmp_name] => /tmp/phpOATbcM
                            [error] => 0
                            [size] => 87232
                        )

                    [1] => Array
                        (
                            [test_form] => 
                        )

                    [2] => 2016-08-29 12:52:30
                )

        )

    [7] => Array
        (
            [file] => /srv/www/{CLIENT}/htdocs/wp-admin/async-upload.php
            [line] => 91
            [function] => media_handle_upload
            [args] => Array
                (
                    [0] => async-upload
                    [1] => 0
                )

        )

)

[29-Aug-2016 19:52:31 UTC] PHP Fatal error:  Cannot use object of type WP_Error as array in /srv/www/{CLIENT}/htdocs/wp-content/plugins/windows-azure-storage/includes/class-windows-azure-helper.php on line 413
[29-Aug-2016 19:55:00 UTC] PHP Notice:  add_utility_page is <strong>deprecated</strong> since version 4.5.0! Use add_menu_page() instead. in /srv/www/{CLIENT}/htdocs/wp-includes/functions.php on line 3706
[29-Aug-2016 19:55:01 UTC] PHP Warning:  array_flip() expects parameter 1 to be array, object given in /srv/www/{CLIENT}/htdocs/wp-content/plugins/windows-azure-storage/includes/class-windows-azure-rest-api-client.php on line 1165
[29-Aug-2016 19:55:01 UTC] PHP Warning:  array_flip() expects parameter 1 to be array, object given in /srv/www/{CLIENT}/htdocs/wp-content/plugins/windows-azure-storage/includes/class-windows-azure-rest-api-client.php on line 1165

0 Byte file when 'uploads_use_yearmonth_folders' set to 0 (OFF)

There is a minor issue when "uploads_use_yearmonth_folders" in wordpress options is set to 0.
This particular use case is when using Wordpress multisite.
On line 445 in windows-azure-storage.php

\Windows_Azure_Helper::put_media_to_blob_storage(
		$default_azure_storage_account_container_name,
		$blob_name,
		trailingslashit( $file_upload_dir ) . $size['file'],
		$mime_type
	);

the value of the 3rd param (trailingslashit( $file_upload_dir ) . $size['file'],) is "\myimage-150x150.png" which causes the upload to return false.
This can be replaced with

\Windows_Azure_Helper::put_media_to_blob_storage(
		$default_azure_storage_account_container_name,
		$blob_name,
		$blob_name,
		$mime_type
	);

to get rid of this issue.

I would like to know why was trailingslashit( $file_upload_dir ) . $size['file'] added when on line 411 on the same file $relative_file_name is used for both the parameters.

:)

[Bug] Visual artifact during editing with Elementor

There's an incompatibility with Elementor and Azure Storage for Wordpress.
The Azure Add Media image from the button overlays the textbox, preventing it from being focused.

image

The button doesn't function either -- fixing the image width and height to 18px like its sibling (Add Media button) clears the textbox, however it still doesn't do anything.

image
image

It should either be hidden, or fixed.

Work along with Gravity Forms file upload field

I recently discovered that when working with Gravity Forms upload fields, the files are not uploaded to Azure.

The reason for this is that GF does not trigger this upload procedure (understandable), but they just move the file from their temp dir to the local uploads dir.

Of course it would be great when these two plugin would work together, but is there a way/function to manually trigger the upload process, so we can upload the files ourselves to Azure?

Thanks!

Image filename includes special characters

I can't seem to find where https://github.com/10up/windows-azure-storage/blob/master/images/Azure%202017.png is utilized within the codebase or on .org (https://wordpress.org/plugins/windows-azure-storage), but that space in the filename may eventually cause problems if that images gets used somewhere/somehow. I'd recommend we check to see if its needed and if not then remove from the repo, but if its needed we should consider renaming the file to eliminate special characters.

Srcset not generating correct urls when using CNAME

Same issue as closed #13 (was closed for non-activity). When using CNAME to Azure CDN (storage origin), the srcset paths are generated with the default WP relative path of "/wp-content/uploads" rather than the cdn path. This happens in the WP default theme.

The browser then tries to fetch the image using the CDN endpoint + incorrect relative path + blob name (e.g. "https://cdn.azureedge.net/wp-content/uploads/blob.jpg" which in my case should be "https://cdn.azureedge.net/media/blob.jpg").

Thanks!

Migrate existing media.

Hey!

I have an existing wp blog with images located in the uploads folder locally on the server.

I would like to migrate to azure.

  • I have full access to WP Db and the codebase
  • I have already copied all the images to azure storage

My idea is something like this.

load all posts of type attachment
for each post call "some function" in the azure plugin to mimic what happens on a file upload.

I need help with what functions to call in the plugin. As the images are already located in azure storage i don't need to transfer any files.

I guess parts of
windows_azure_storage_new_media_object
and
windows_azure_storage_wp_update_attachment_metadata
should do the job but i know to little about the plugin and WP filters/hooks to figure it out.

Not uploading images on Post Add Media

In my wordpress site form the "Desktop" and then navigating to "Media" I can upload files to azure.

But when I am editing a Post and try to upload an Image. The Windows shows a message saying "Uploading to Azure (1/9)" the image appears broken and the uploaded file to Azure is 0B size and appendblob type.

I am using the develop branch as you suggest in the support forum. Also I've change the permisions config but the issue is still happening

Upload problem on Windows Server

Describe the bug

Upload problem on Windows Server.
The following upload url is registered.
https://containername.blob.core.windows.net/images/D:\home\site\wwwroot/wp-content/uploads/2019/11/image.png

should be:
https://containername.blob.core.windows.net/images/2019/11/image.png

Steps to Reproduce

  1. Install WordPress on Windows Server.
  2. Install this plugin.
  3. Upload image to Media Library.
  4. See error

Expected behavior

File upload is possible on Windows.

Screenshots

スクリーンショット 2019-11-24 21 18 51

Environment information

  • Server: Windows NT RD0003FF478ED3 10.0 build 14393 (Windows Server 2016) i586 (Microsoft Azure WebApps)
  • OS: MacOS 10.15.1
  • Browser and version: Safari 13.0.3
  • Plugins and version: 4.3.0
  • Theme and version: Twenty Seventeen 2.2

Additional context

Does not work with BuddyPress Front-End Editor

For Example: when viewing a wiki post, the styling is missing and the click doesn't do anything. When looking at the source there is no JS or CSS includes. If I include the CSS the formatting issues are fixed, however the button remains inoperable if the JS files are included. Please see the attached image.

azurestorage

Srcset returning the wrong url when using crop thumbnail plugin

Hello,

When I cropped an image the srcset url isn't azure storage url only for WP native image size such as the thumbnail. You can have an exemple at the bottom of the post in the section "Découvrez également" : https://experiences.microsoft.fr/business/new-culture-of-work-business/linnovation-appelle-un-equilibre-entre-ambition-et-humilite-nicolas-marry-avanade/

Once the image is cropped, the srcset url change to "https://experiences.microsoft.fr/wp-content/uploads/..."
and it should be "https://experienceswp.blob.core.windows.net/uploads/..."

I also opened an issue at Crop Thumbnail GitHub if you want more details, they say it may be a synchronization problem from Azure Storage : vollyimnetz/crop-thumbnails#29

The problem persist for every crop plugin used.

Update branding to Microsoft Azure Storage

Is your enhancement related to a problem? Please describe.
The naming (but not slug) for this project has been updated to "Microsoft Azure Storage for WordPress", but there are still some stray comments and non-code items in this repo that still reference "Windows Azure" instead of "Microsoft Azure".

Describe the solution you'd like

  • update comments and non-code items to "Microsoft Azure"
  • update banner/icon as necessary and with provided assets from Microsoft

Designs
TBD if banner/icon could/should be updated

Describe alternatives you've considered
n/a

Additional context
n/a

Unicode file name support

Hello,

based on this issue opened on WP support forum https://wordpress.org/support/topic/non-encoded-urls/ plugin can't handle properly with paths / filenames / directories with unicode characters.

Tested on slovak characters. Adding php function urlencode helps.
I don't open any PR, because I can't say if exists any other code parts, where url encoding is required.

This document https://docs.microsoft.com/en-us/rest/api/storageservices/naming-and-referencing-containers--blobs--and-metadata#resource-names says, in Important block, that all names with certain characters should be percent-encoded. Don't know what certain characters are, but urlencode helps.

Maybe there is better way how to fix it.

Ambiguity around crucial element of settings page

Is your enhancement related to a problem? Please describe.

I have low familiarity with this plugin and am attempting to use it for the first time. In getting set up, I come across the following setting:

Screen Shot 2019-10-24 at 9 50 12 PM

Use for default upload | Use Microsoft Azure Storage when uploading via WordPress' upload tab.Note: Uncheck this to revert back to using your own web host for storage at anytime. You can define MICROSOFT_AZURE_USE_FOR_DEFAULT_UPLOAD to override it.

Even as a WordPress engineer, I am not sure how to interpret this. Does "Upload tab" refer to the "Upload Files" tab in the media uploader when I'm creating the post? If I check this box, will Azure storage be used there but not in wp-admin/upload.php? What about in wp-admin/media-new.php?

When I don't have this box checked, does it effectively mean that Azure is only used when I access it through this "Add Media from Azure" button?

Screen Shot 2019-10-24 at 9 55 07 PM

Outside of the screen brought up by that button, it's hard to know when I am uploading to Azure and when I'm not.

Describe the solution you'd like

The plugin should provide more clarity around this setting. The "Upload tab" language is the main point of confusion, but there should also be something to address what happens in wp-admin/uploads.php and in other locations outside the post editor, and perhaps something in the UI wherever we are uploading to Azure to make that apparent.

Designs

Describe alternatives you've considered

Additional context

Testing for the purposes of 10up/classifai#149, though that PR doesn't depend on this.

I'd be happy to submit a PR for this, but first I would need to understand more about how the plugin works.

Undefined index: _wpnonce

We're using Windows Azure Storage in conjunction with the WPLR Sync plugin, and are getting an error "Underfined index: _wpnonce" originating from this line here.

The issue seems to be that the method is expecting the _wpnonce field to be included in the $_POST, but in this case it's not.

Would a suitable workaround be to replace $post_array['_wpnonce'] with wp_create_nonce('windows_azure_storage_progress')?

Repo documentation updates

Is your enhancement related to a problem? Please describe.
It's not obvious the level of support provided for this repo, so let's add some clarification.

Describe the solution you'd like

  • add support level section and badge
  • add release version badge
  • add WP tested up to badge
  • add license badge
  • move changelog to its own file

Designs
n/a

Describe alternatives you've considered
n/a

Additional context
n/a

Allow for fully custom domains and paths

Microsoft is pushing for the Azure CDN network to replace the custom domain part of Storage accounts - specifically, (custom) SSL is only possible on these domains at the moment.

However Azure CDN also allows for a more in-depth Origin to be set. The custom domain is not just a CNAME to the Storage account URL, it can point to a blob, a folder within the blob, or even a specific file (albeit hacky to achieve).

The plugin right now only allows to set a custom CNAME, which will still retain the usual [baseurl]/[blobname]/path/to/file.png path. Which means once someone sets the CDN up to point to the specific blob, the plugin dies.

I'd like to request the ability to customize the URL, with a few preset patterns:

  • Base URL - this would be the value from the current CNAME field
  • Blob name - the blob storage's name, obviously
  • File path - the path to the file (in case of e.g. https://mystorage.blob.core.windows.net/blobname/2018/12/myimage.png this would be 2018/12 (possibly with the backslashes added at start and end)
  • File name
  • File extension

The system I have in mind would allow for a custom CNAME to be set, and the URL pattern field would act similar to how e.g. Sonarr's custom naming field works. Such as, typing in this:

  • File path: /2018/12/
  • File name: image
  • File extension: png
  • Blob: myblob
  • CNAME: cdn.mysite.domain
  • URL pattern: {baseUrl}/{blobName}/{file.path}/{file.name}.{file.extension}

would put this URL together: `cdn.mysite.domain/myblob/2018/12/image.png

Whereas the URL pattern {baseUrl}/{file.path}/{file.name}.{file.extension} would result in cdn.mysite.domain/2018/12/image.png.

I understand that this isn't a two-day thing to do, but would be awesome to see this someday. It would definitely increase the flexibility of the plugin.

Docs need updating to ensure uploads get to Azure storage

Setting up the v4.2.0 version of the plugin throws an Microsoft Azure Storage requires direct filesystem access in order to work. error even with permissions appearing to be correct on the wp-content/uploads directory. Things appear to be configured correctly, but nothing is getting uploaded to Azure storage.

After some triage, it appears that the plugin requires the following defines in wp-config to work:

define( 'FS_METHOD', 'direct' );
define( 'DISALLOW_FILE_MODS', 'true' );

Let's ensure we update the docs to account for this necessary update.

Zero Byte Uploads

When uploading non-image files (sound or video files, 599 KB m4a file for example) to WordPress media library, we find that a few seconds after the file is uploaded it is no longer playable. If we try to play immediately from media library after upload done, it plays fine, but if we revisit file a few seconds later and try to open/play, it no longer plays. In background we find that file gets set to zero bytes and remains in blob store showing that size and non-playable at that point..
Environment: Clean install of WordPress 4.8.2 for testing this issue in clean environment, with plugin version 4.0.3 and the default WordPress twenty-seventeen theme. No other plugins activated and no customizations existing in site in any way. Only this plugin configured for testing this issue. Can you please look into for us.

foreign characters file name problems

Hi, can u or can I figure out line number for the sanitizing filename?
my Korean character image file got some error when I try to upload to blob storage.

I think there might be a lot of people who need to fix this problem.

could you update plugin or u can tell me the line number for that function, so that I can make it allow foreign characters file name works with this awesome plug-in.

thanks

Release version 4.3.0

This issue is for tracking changes for the 4.3.0 release. Target release date: TBD

Pre-release steps

  • add CONTRIBUTING.md file including release instructions via #104
  • add CREDITS.md file with previous contributors, listing current maintainers
  • resolve issues in #102, then merge to master
  • ensure #99 is updated to include all changes in master, then merge
  • review #87 to see if it's viable for the 4.30 release, if so ensure it's updated to develop and then merge
  • review #84 #102 to see if it's viable for the 4.30 release, if so ensure it's updated to develop and then merge
  • review #74 to see if it's viable for the 4.30 release, if so ensure it's updated to develop and then merge
  • review #70 to see if it's viable for the 4.30 release, if so ensure it's updated to develop and then merge punted to Future Release
  • merge #100

Release steps

  • Starting from develop, cut a release branch named release/4.3.0 for your changes.
  • Version bump: Bump the version number in windows-azure-storage.php and readme.txt if it does not already reflect the version being released.
  • Changelog: Add/update the changelog in both readme.txt and CHANGELOG.md.
  • Check to be sure any new files/paths that are unnecessary in the production version are included in .distignore.
  • Readme updates: Make any other readme changes as necessary. CHANGELOG.md and README.md are geared toward GitHub and readme.txt contains WordPress.org-specific content. The two are slightly different.
  • Merge: Make a non-fast-forward merge from develop to master (git checkout master && git merge --no-ff develop).

STOP HERE UNTIL GITHUB ACTIONS CONFIRMED WORKING

  • Release: Create a new release, naming the tag and the release with the new version number. Paste the changelog from CHANGELOG.md into the body of the release and include a link to the closed issues on the milestone (e.g. https://github.com/10up/windows-azure-storage/milestone/2?closed=1). Close the milestone.
  • SVN: Wait for the GitHub Action to finish deploying to the WordPress.org repository. If all goes well, users with SVN commit access for that plugin will receive an emailed diff of changes.
  • Check WordPress.org: Ensure that the changes are live on https://wordpress.org/plugins/windows-azure-storage/. This may take a few minutes.
  • Edit the 4.3.0 milestone with release date (in the Due date (optional) field) and link to GitHub release (in the Description field), then close 4.3.0 milestone.
  • If any open issues or PRs which were milestoned for 4.3.0 do not make it into the release, update their milestone to 4.4.0 or Future Release.

Add GitHub Action workflows for deployment

Is your enhancement related to a problem? Please describe.
Let's add the GitHub Action workflows to allow for automated deploys to WordPress.ORG.

Describe the solution you'd like

  • Add plugin deploy workflow
  • Add asset deploy workflow
  • Add user/pass secrets to repo settings
  • Add build step

Designs
n/a

Describe alternatives you've considered
keep deploying manually 👎

Additional context
n/a

AYS prompt when trying to upload to Azure

When uploading an image throught eAzure Media Loader, some users are met with "Are you sure you want to do this?", which is an indicator of a nonce check failing along the way.

Strange path is appended to Azure storage path, and upload failes as a result

I updated to 4.3.0 version of the plugin and to WordPress 5.3.2.
Now whenever I upload a picture, the upload completes, but the image never ends up in Blob storage.

Upon closer inspection, WordPress thinks the file path is something like this:

https://bloburl/container/D:homesitewwwroot/wp-content/uploads/2020/01/filename.png

Instead of the usual

https://bloburl/container/2020/01/filename.png

Here bloburl is the Blob storage url and container is the configured value for the container I am using. I have been using this plugin since 2015, and it has used the URL format I named "usual" ever since. This update brought along this change.

So it adds the prefix:

D:homesitewwwroot/wp-content/uploads/

Which probably is the reason for the failure.

Environment:
Azure App Service

Zero byte upload when running in a docker container

I have the zero byte upload problem, seems to be that the plugin cant get access to wp filesystem.
The call to WP_Filesystem fails in Windows_Azure_Filesystem_Access_Provider.get_provider, even though i have chmod 777 to the upload path for testing, and chown for whole wp-content to www-data user.

strange thing is that the file is actually stored in the uploads folder with correct size, owner is www-data and it has rw permission.

running in a docker container php:7.1-apache image.
running latest plugin and latest wp.

to clarify, this is for image files.

Catchable fatal error when new media is uploaded

When uploading media (a PNG) via wp-admin/media-new.php, I received an HTTP error message in the admin UI.

In my debug.log, I found the following error:

[29-Aug-2016 19:37:41 UTC] PHP Catchable fatal error:  Argument 1 passed to Windows_Azure_Rest_Api_Client::inject_authorization_header() must be of the type array, string given in /srv/www/{CLIENT}/htdocs/wp-content/plugins/windows-azure-storage/includes/class-windows-azure-rest-api-client.php on line 526

This dev environment is running WordPress 4.5.3.

Uploading status doesn't update after upload is finished.

Describe the bug

When uploading a file in the Media Library the uploading status is changing but it never goes to 100% and it gets stuck and it shows on all the attachment details window titles (regardless if you are looking at the file you just upload or an older file)

Steps to Reproduce

  1. Go to Media -> Library: wp-admin/upload.php
  2. Click on Add New
  3. Choose a file
  4. Once the upload finishes click on the file to get the attachment "window" details
  5. See window title says: Uploading to Azure... (x/y)
    Screen Shot 2019-07-24 at 10 41 37 AM
  6. If you click on older files it will say the same "Uploading to Azure..."

Expected behavior

The window title should clear and be "Attachment Details" - if you refresh the media library and click again you will see it.
Screen Shot 2019-07-24 at 10 45 19 AM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.