Netlify large media transformation

Instance: hopeful-kirch-c9adc4

I enabled Netlify LFS and stored my pictures in it. It’s served on the website but I can’t make work the media transformation on my website. It’s weird because, when I go on the website, the pictures are displayed like they are not transformed. But when I type the media URL and access directly the file, the transformation is made. I have absolutely no clue on what’s going on.

Any idea?

Hi, @clawfire. It is working for some images and not for others. This is happening because some images are stored in Large Media and others are not. Here is an example of an image using Large Media and where image transformations are working:

https://thibaultmilan.com/images/profile.jpg
https://thibaultmilan.com/images/profile.jpg?nf_resize=smartcrop&w=100&h=500

And two URLs for an image on the site but not stored in Large Media (here the transformations do not work):

https://thibaultmilan.com/img/2020/04/20191210_123325-1.jpg
https://thibaultmilan.com/img/2020/04/20191210_123325-1.jpg?nf_resize=smartcrop&w=100&h=50

You can see which images are tracked here:

https://app.netlify.com/sites/hopeful-kirch-c9adc4/large-media

It looks like wildcard was interpreted as the part of the actual file name. The solution in this case will be to add the images to Git LFS tracking. There is more information about how to do this here:

Once you are sure the images are being tracked by Git LFS, you can force them to be uploaded to Large Media using this:

git lfs push --all origin

The final step will be to make a new deploy (some change and git push to trigger a build) and the images should then be correctly tracked by Large Media. Once this is done the image transformations will work.

If this doesn’t work as promised or if there are any questions, please let us know.

OMG thank you.

I gonna call PEBKAC on this one. I use an incorrect glob: img/**.{png,jpg,jpeg} which then only take pictures at the root of the img folder.

I should use something like img/**/**.{png,jpg,jpeg in fact.

But now I got an error trying to run git lfs push --all origin :

Error reading git config: Error running /usr/local/Cellar/git/2.23.0_1/libexec/git-core/git 'config' '-l' '-f' '/Users/thibault/Projets/thibaultmilan.com/.lfsconfig': 'fatal: ligne 1 de config incorrecte dans le fichier /Users/thibault/Projets/thibaultmilan.com/.lfsconfig' 'exit status 128'
Remote "origin" does not support the LFS locking API. Consider disabling it with:
  $ git config lfs.origin.git/info/lfs.locksverify false
Uploading LFS objects:   0% (0/1), 0 B | 0 B/s   

And the upload is just stuck.

ok weird. My git-credential-netlify where outdated.

  1. I run brew upgrade netlify/git-credential-netlify/git-credential-netlify
  2. I remove the .lsfconfig from my working copy
  3. I run netlify lm:setup again to re-create it. The sha is different. weird.

Uploading seems to start then …

Authentication required: Authorization error: https://475d9066-7ec4-4ac4-a1da-b80a61a9daa3.netlify.app/.netlify/large-media/verify
Check that you have proper access to the repository

Ok so. So far I removed completly git-lfs from my repo and get back all the files and clean the git log a bit :smiley:

Next step :arrow_right: enable it correctly for png, gif and jpeg (and PDF or .zip / .tar.gz )

1 Like

awesome. glad you were able to get it back. let us know if you need help as you go along!