             return UIMenu(title: url.absoluteString, children: actions)
         }))
     }
+    
+    func writeToPhotoAlbum(image: UIImage) {
+        UIImageWriteToSavedPhotosAlbum(image, self, #selector(saveError), nil)
+    }
+
+    @objc func saveError(_ image: UIImage, didFinishSavingWithError error: Error?, contextInfo: UnsafeRawPointer) {
+        guard error != nil else { return }
+        DispatchQueue.main.async {
+            let accessDenied = UIAlertController(title: Strings.PhotoLibraryFirefoxWouldLikeAccessTitle, message: Strings.PhotoLibraryFirefoxWouldLikeAccessMessage, preferredStyle: .alert)
+            let dismissAction = UIAlertAction(title: Strings.CancelString, style: .default, handler: nil)
+            accessDenied.addAction(dismissAction)
+            let settingsAction = UIAlertAction(title: Strings.OpenSettingsString, style: .default ) { _ in
+                UIApplication.shared.open(URL(string: UIApplication.openSettingsURLString)!, options: [:])
+            }
+            accessDenied.addAction(settingsAction)
+            self.present(accessDenied, animated: true, completion: nil)
+        }
+    }
 }
 
 extension WKNavigationAction {

import Foundation
import WebKit
import Shared
import Photos

private let log = Logger.browserLogger


            })

            if let url = elements.image {
                actions.append(UIAction(title: Strings.ContextMenuSaveImage, identifier: UIAction.Identifier("linkContextMenu.saveImage")) { _ in
                    getImageData(url) { data in
                        guard let image = UIImage(data: data) else { return }
                        self.writeToPhotoAlbum(image: image)
                    }
                })

