خرید بک لینک

Vote count: 0

I am uploading an image on the GCS and then overwriting it with a different with same file name (image.png). In the GCS browser, I can see the image being overwritten (different size, timestamp) but when I try to get the URL of the image using getServingUrl() I get the URL of the image that I uploaded the very first time!!!

Here is my code:

String bucketName = "my_bucket_name";
    String userFileName = "image.png";
    try {
        GcsFileOptions instance = GcsFileOptions.getDefaultInstance();
        GcsFilename fileName = new GcsFilename(bucketName, userFileName);// getFileName(request);
        GcsOutputChael outputChael;
        gcsService.delete(fileName);
        outputChael = gcsService.createOrReplace(fileName, instance);
        copy(request.getInputStream(), Chaels.newOutputStream(outputChael));
    } catch (IOException e) {
        System.out.println(e.getMessage());
    }

    ImagesService imagesService = ImagesServiceFactory.getImagesService();

    String url = imagesService.getServingUrl(ServingUrlOptions.Builder.withGoogleStorageFileName("/gs/" +
            bucketName + "/" + userFileName).secureUrl(true));

Can anyone please tell me what I am missing here? How to get the ImagesService to give me the handle to newly uploaded image? Thanks.

asked 2 mins ago

برچسب: نویسنده: استخدام کار تاريخ: سه شنبه 18 خرداد 1395 ساعت: 12:45

صفحه بندی