Repository navigation
Transformation erroneously replacing all overlay spaces to underscore #160
Description
Activity
aditimadan-Cloudinary commented
on Feb 9, 2019 ContributorMore actionsHi Eduard,
Can you please try using %20 instead of space and test
Eg:
cloudinary.url() .signed(true) .resourceType("video") .transformation(new Transformation() .height(480) .width(720) .crop("fill") .chain() .color("white") .overlay("text:Roboto%20Condensed_70_bold:My%20Text%20Content")) .format("jpg") .generate("video/2130");Thanks,
AditiReacted by Eduardo MelzerHi Aditi,
Using
%20works, thanks!Is this a particularity of the cloudinary's java sdk?
aditimadan-Cloudinary commented
on Feb 9, 2019 ContributorMore actionsHi Eduard,
That was a workaround. We also have a TextLayer class - that already handles all the encoding for you: https://github.com/cloudinary/cloudinary_java/blob/master/cloudinary-core/src/main/java/com/cloudinary/transformation/TextLayer.java
Example:
TextLayer t=layer.text("Roboto Condensed_70_bold:My Text Content"); String url=cloudinary.url() .signed(true) .resourceType("video") .transformation(new Transformation() .height(480) .width(720) .crop("fill") .chain() .color("white") .overlay(t)) .format("jpg") .generate("video/2130");Thanks,
AditiReacted by Eduardo MelzerHi Aditi,
using
%20in text font style throws below error:
Unknown text style - Roboto%20Condensed_48_LEFTcode:
String source = "https://qa4-cdata-app.sprinklr.com/EXPORT/400002/d00a533e-18d9-469e-92c0-e191b1141424-1528232385/VORK5CYII_.png"; Transformation transformation = new Transformation().chain().overlay("text:Roboto%20Condensed_48_LEFT:This%20is%20static"); final Map<String, Object> options = Maps.newHashMap(); options.put("public_id", "transformation_test"); options.put("transformation", transformation); cloudinary.uploader().upload(source, options);aditimadan-Cloudinary commented
on Oct 15, 2020 ContributorMore actionsHi Sagar,
As I mentioned in my last response that using %20 was a workaround. You can use the TextLayer class that already handles all the encoding for you: https://github.com/cloudinary/cloudinary_java/blob/master/cloudinary-core/src/main/java/com/cloudinary/transformation/TextLayer.java. And if you still have any issues then please raise a support ticket here:https://support.cloudinary.com/hc/en-us/requests/new and share your cloud name so that I can check further.
Hi Aditi,
I used TextLayer and it encodes text, but the issue is Cloudinary doesn't accept encoded font style.
So I want to pass font style with space to Cloudinary but the library doesn't support that. it replaces space with an underscore.After changing the logic of this method to not replace space with the underscore and it's working fine.
Thanks.
aditimadan-Cloudinary commented
on Oct 16, 2020 ContributorMore actionsHi Sagar,
Can you please share your cloud name and I will be able to check further? I just tested a font file with space in between using the TextLayer class and it worked. Please add the format at the end of the overlay when accessing a custom font.
TextLayer t=layer.text("Roboto Condensed.ttf_70_bold:My Text Content");
Another thing to check will be the name of the file should be the same as the uploaded file.
You can also open a support ticket and share the cloud name if privacy is a concern.Hi Aditi,
I have opened a support ticket #133163. can you please check?
Also, The issue is with the font name with space (i. e. Roboto Condensed) and not the font file.Thanks.
Hi @sagar-savaliya - Thanks for raising the ticket. I've just responded on there.
Currently, Transformation class is replacing all spaces on parameters to underscore in this line:
cloudinary_java/cloudinary-core/src/main/java/com/cloudinary/Transformation.java
Line 723 in 738b328
This is causing some issues, like when I try to use some font name that contains spaces (eg: Roboto Condensed), it replaces with underscores and the URL become invalid (because font is invalid). The same applies to text content (overlay), when using the text
My Text Contentit appears on final Image asMy_Text_Content.Example:
Results in:
