Uploading



  • Hey Jon-

    1. Imgix + Google Cloud Storage, Dynamic Uploads disabled, Dynamic Images disabled.
    2. Version 3.2.6
    3. We can upload PDF's directly to media library fine.
    4. When uploading PDF's to Advanced Custom Field via Woocommerce Product it errors out in the front end with this:
      86ba0b8a-872f-4e80-afab-58fc149bcdda-image.png
    5. At that point the PDF is in the media library, but not in the cloud, and does not show up in the current media upload dialog.
    6. Here is the server log for the event:
      appserver_1 | 172.29.0.4 - 03/Dec/2019:18:29:18 +0000 "GET /index.php" 200
      appserver_1 | NOTICE: PHP message: PHP Fatal error: Uncaught Error: Call to a member function getImageFormat() on null in /app/web/wp/wp-includes/class-wp-image-editor-imagick.php:672
      appserver_1 | Stack trace:
      appserver_1 | #0 /app/web/wp/wp-includes/class-wp-image-editor-imagick.php(641): WP_Image_Editor_Imagick->_save(NULL, 'media/sample-2-...', 'image/jpeg')
      appserver_1 | #1 /app/web/wp-content/plugins/ilab-media-tools-premium/classes/Tools/Storage/StorageImageEditor.php(271): WP_Image_Editor_Imagick->save('media/sample-2-...', 'image/jpeg')
      appserver_1 | #2 /app/web/wp-content/plugins/ilab-media-tools-premium/classes/Tools/DynamicImages/DynamicImageEditor.php(252): ILAB\MediaCloud\Tools\Storage\StorageImageEditor->save('media/sample-2-...', 'image/jpeg')
      appserver_1 | #3 /app/web/wp/wp-admin/includes/image.php(570): ILAB\MediaCloud\Tools\DynamicImages\DynamicImageEditor->save('mappserver_1 | 172.29.0.4 - 03/Dec/2019:18:33:27 +0000 "POST /wp/wp-admin/admin-ajax.php" 200
      appserver_1 | 172.29.0.4 - 03/Dec/2019:18:33:30 +0000 "POST /wp/wp-admin/admin-ajax.php" 200

    Here is another variation....
    appserver_1 | 172.29.0.4 - 03/Dec/2019:18:40:54 +0000 "POST /wp/wp-admin/admin-ajax.php" 200
    appserver_1 | NOTICE: PHP message: PHP Fatal error: Uncaught Error: Call to a member function getImageFormat() on null in /app/web/wp/wp-includes/class-wp-image-editor-imagick.php:672
    appserver_1 | Stack trace:
    appserver_1 | #0 /app/web/wp/wp-includes/class-wp-image-editor-imagick.php(641): WP_Image_Editor_Imagick->_save(NULL, 'media/sample-pd...', 'image/jpeg')
    appserver_1 | #1 /app/web/wp-content/plugins/ilab-media-tools-premium/classes/Tools/Storage/StorageImageEditor.php(271): WP_Image_Editor_Imagick->save('media/sample-pd...', 'image/jpeg')
    appserver_1 | #2 /app/web/wp-content/plugins/ilab-media-tools-premium/classes/Tools/DynamicImages/DynamicImageEditor.php(252): ILAB\MediaCloud\Tools\Storage\StorageImageEditor->save('media/sample-pd...', 'image/jpeg')
    appserver_1 | #3 /app/web/wp/wp-admin/includes/image.php(570): ILAB\MediaCloud\Tools\DynamicImages\DynamicImageEditor->save('media/sample-pd...', 'image/jpeg')
    appserver_1 | #4 /app/web/wp/wp-admin/includes/media.php(419): wp_generate_attachment_metadata(17759, 'media/sample.pd...')
    appserver_1 | #5 /app/web/wp/wp-admin/includes/ajax-actions.php(2542): media_handle_upload('async-upload', '6193', Array in /app/web/wp/wp-includes/class-wp-image-editor-imagick.php on line 672
    appserver_1 | 172.29.0.4 - 03/Dec/2019:18:40:56 +0000 "POST /wp/wp-admin/async-upload.php" 500



  • ahhh man - I jacked up the title!

    Should read: Upload PDF directly from Woocommerce product fails with imagick error.



  • @wholesalesolar

    Can you explain or show me your setup a bit more so I can replicate? I don't really do WooCommerce but I do a lot of ACF.



  • Hey Jon-

    First, let me say again, how amazing your product is. It's truly the first enterprise grade media management solution for wordpress. It works, and when paired with Imgix - it's a total game changer for Wordpress.

    I'm available to assist in getting these Woocommerce issues resolved. To have full Woocommerce compatibility is a big win.
    I'm recommending Media Cloud to large WP+WC clients that are all about REST api data integrations with external systems.

    I would suggest just installing vanilla woocommerce and let it sit in your dev environments. Setup a few products.

    Details:
    I've had to patch some Media Cloud code, and also some WP core stuff to get through our bulk product load into WP.

    Woocommerce supports 'sideloading' images into WP via their rest api. It makes importing images MUCH easier then using the standard rest api. Basically, a list of image urls is posted along with product data, and WC grabs the images from the urls and creates the media posts, etc. There are some issues here with the way sideloading and Media cloud are interacting. I just patched (hacked) 3 things in core and 1 thing in Media Cloud - they were not fixes - more like "move along, nothing to see here" hacks. All the images and pdfs made it through.

    Setup:

    1. Media Cloud . Imgix. Google Cloud. Allowing images, pdfs, docs, etc. Direct Uploading is disabled. (conflict with Real Media Library js on the admin front end. RML does not have any backend hooks - though they do have a nice rest api.)
    2. Woocommerce 3.8.1
    3. ACF Pro 5.8.7
    4. wc-api-php > https://github.com/woocommerce/wc-api-php
    5. Create a product via the wc php api, include a list of image urls in the image property payload.

    Symptoms in our environment:

    1. When sideloading media through WC rest api, there are various undefined index errors in wp-admin/includes/file.php & image.php. Additionally in ilab-media-tools-premium/classes/Tools/Storage/StorageTool.php
    2. When uploading media via admin front end, files are not being deleted from the local file system. They end up in the cloud, and the local files stay in uploads/media. They DO get deleted when deleted from the media library.
    3. When sideloading media through the WC rest api the files end up in the cloud, but on the local file system they go to upload/{year}/{month}. They also get deleted properly when deleted from the media library.
    4. Media cloud has some issues with PDF's.

    Screenshots of the patches:

    1. wp-admin/includes/file.php > undefined index $file['type']
      626eaf73-44c5-4c72-921f-aa245d7a1a95-image.png

    2. wp-admin/includes/image.php > undefined index $saved_data['path']
      312eb3a5-ffaa-47ce-8c00-fbc55bc434ab-image.png

    3. wp-admin/includes/image.php > undefined index $uploaded['path']
      144fa62a-b549-4ad1-be3d-c6cb2a987b1f-image.png

    4. ilab-media-tools-premium/classes/Tools/Storage/StorageTool.php > undefined index $this->pdfInfo[$s3Info['file']]
      0652b437-be5f-4f26-bd2e-5afba5d3f8aa-image.png


Log in to reply