0

We are currently running a script to migrate from a custom CMS to WordPress. Everything is going perfectly well except for the "media manager".

The media is all stored on a S3 bucket. Here is a sample: CDN_LOCATION/2018/12/13/06/19/22761255000000_original.jpg

We are re-creating the media item and mapping all the thumbnails accordingly and it all works perfectly fine. On the frontend everything loads good and all the different sizes load perfect. On the Admin Panel featured images display correctly.

But the problem is the media manager thumbnail URLs are incorrect and the system automatically adds an additional part on its own disrupting the correct URL:

enter image description here

The additional part automatically takes the folder structure from the original image and implements it on the thumbnails (all we need is to disable this basically).

We are using Offload Media Lite plugin for the S3/CDN.

Below is how the meta is saved which is correct and reflecting on the site.

a:4:{s:4:"file";s:44:"2018/12/13/06/19/22761255000000_original.jpg";s:5:"width";i:880;s:6:"height";i:440;s:5:"sizes";a:7:{s:12:"medium_large";a:4:{s:4:"file";s:42:"2018/12/13/06/19/22777933000000_43_768.jpg";s:5:"width";i:768;s:6:"height";i:576;s:9:"mime-type";s:10:"image/jpeg";}s:5:"large";a:4:{s:4:"file";s:44:"2018/12/13/06/19/22767710000000_169_1024.jpg";s:5:"width";i:1024;s:6:"height";i:576;s:9:"mime-type";s:10:"image/jpeg";}s:10:"in_article";a:4:{s:4:"file";s:43:"2018/12/13/06/19/22766657000000_169_960.jpg";s:5:"width";i:960;s:6:"height";i:540;s:9:"mime-type";s:10:"image/jpeg";}s:5:"small";a:4:{s:4:"file";s:42:"2018/12/13/06/19/22770802000000_43_192.jpg";s:5:"width";i:192;s:6:"height";i:144;s:9:"mime-type";s:10:"image/jpeg";}s:9:"thumbnail";a:4:{s:4:"file";s:42:"2018/12/13/06/19/22769797000000_43_160.jpg";s:5:"width";i:160;s:6:"height";i:120;s:9:"mime-type";s:10:"image/jpeg";}s:6:"medium";a:4:{s:4:"file";s:42:"2018/12/13/06/19/22771810000000_43_240.jpg";s:5:"width";i:240;s:6:"height";i:180;s:9:"mime-type";s:10:"image/jpeg";}s:11:"v-rectangle";a:4:{s:4:"file";s:42:"2018/12/13/06/19/22771810000000_43_240.jpg";s:5:"width";i:240;s:6:"height";i:180;s:9:"mime-type";s:10:"image/jpeg";}}}40

and this is the rest of the metadata:

enter image description here

Can anyone help let us know what are we doing wrong? How can I tell media library not to randomly add this bit of code? Funny enough when we click on it and go to the actual media the path and URL on the right are correct but again the large image has the exact same problem where it chooses to add that addition to it.

  • 1
    This is because the media manager is treating each addition as an entirely new upload to Wordpress thus implementing the structure into the file name where it would usually be stored. Have you looked in your upload folder to see if the directory is being built? If so it's more than likely also adding the imagery. – Beaniie Jan 24 at 20:33
  • @Beaniie no, nothing is being stored in the upload folder actually. How are we supposed to just tell media manager not to deal with it like that? – Hossj Jan 25 at 4:46
  • I believe...there is a temporary directory, in which media files pass into, that you need to set "proper" user permissions on, or else you are going to have issues as explained. – klewis Jan 26 at 2:19
  • That /2018/12/13/06/19/ part in the object's path is weird, WP Offload Media Lite does not split out the path beyond YYYY/MM if using that setting. Just a guess, but it looks like you have something altering the object path that is maybe also getting hooked in at the wrong time for the Media page. Normally you alter the object path with the as3cf_object_meta filter, maybe another filter is being used? – ianmjones Jan 28 at 17:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.