0

I have this converter that converts mp4 to GIF using Cloudinary, and after its conversion I suppose the uri is stored in the gifUrl. So basically I want to send that converted GIF to my Firebase Storage. But currently this error pops up :

2019-12-07 14:05:39.392 20220-20220/com.example.bim E/UploadTask: could not locate file for uploading:http://res.cloudinary.com/ds77az4mi/video/upload/c_scale,dl_200,e_loop:10,h_200,vs_25/file_wbujzc.gif
2019-12-07 14:05:39.397 20220-20220/com.example.bim E/StorageException: StorageException has occurred.
    An unknown error occurred, please check the HTTP result code and inner exception for server response.
     Code: -13000 HttpResult: 0
2019-12-07 14:05:39.400 20220-20220/com.example.bim E/StorageException: No content provider: http://res.cloudinary.com/ds77az4mi/video/upload/c_scale,dl_200,e_loop:10,h_200,vs_25/file_wbujzc.gif

The code is as below :

 gifUrl = MediaManager.get().url().resourceType("video")
            .transformation(new Transformation().videoSampling("25")
                    .delay("200").height(200).effect("loop:10").crop("scale"))
            .resourceType("video").generate(publicId+".gif");

    Glide.with(getApplicationContext()).asGif().load(gifUrl).into(img2);


    img2.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {

            Uri uri = Uri.parse(gifUrl);
            final StorageReference Imagename = Folder.child("image" + uri.getLastPathSegment());

            Imagename.putFile(uri).addOnSuccessListener(new OnSuccessListener<UploadTask.TaskSnapshot>() {
                @Override
                public void onSuccess(UploadTask.TaskSnapshot taskSnapshot) {

                    //         Toast.makeText(realupload.this, "Uploaded", Toast.LENGTH_SHORT).show();

                    Imagename.getDownloadUrl().addOnSuccessListener(new OnSuccessListener<Uri>() {
                        @Override
                        public void onSuccess(Uri uri) {

                            Log.d(TAG, source2 + "        MEESSSAAAGGGEE11111111111");
                            DatabaseReference imageStore = FirebaseDatabase.getInstance().getReference().child("main");
                            HashMap<String,Object> hashMap = new HashMap<>();
                            hashMap.put(source2, String.valueOf(uri));

                            imageStore.updateChildren(hashMap).addOnSuccessListener(new OnSuccessListener<Void>() {
                                @Override
                                public void onSuccess(Void aVoid) {
                                    Toast.makeText(realupload.this, "Finally finally Completed", Toast.LENGTH_SHORT).show();
                                }
                            });

                        }
                    });


                }
            });
        }
    });
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Wolfiebae
  • 395
  • 1
  • 5
  • 19
  • 2
    It seems `gifUrl` is remote url, not local. If you'd like to upload to your firebase storage, you first need download it – Tuan Luong Dec 07 '19 at 07:34
  • As Tuang commented, the Firebase Storage clients require that the data to be uploaded is local on the device. They can't upload data from a remote URL. You will either have to first download the data from the URL to the device and then upload it, or you can simply store the existing URL in the database. See https://stackoverflow.com/questions/37686213/upload-image-from-url-to-firebase-storage – Frank van Puffelen Dec 07 '19 at 15:39

0 Answers0