How to attach jpg image which creating ticket

English! place to talk about development, programming and coding
Post Reply
vrushaligave
OTRS newbie
Posts: 3
Joined: 07 May 2021, 08:45
Znuny / OTRS Version: OTRS 6
Real Name: Vrushali Gave

How to attach jpg image which creating ticket

Post by vrushaligave »

Hello, community


I have used the following code for the jpg image attachment.
Attachment => [

"{""ContentType"":""image/jpg"",""Filename"":""image,jpg"",""Content"":""R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==""}"

]

Code is working fine, It is attaching the file to the ticket but it is unable to see the image after downloading.

I have also tried with the following code but it doesn't visible the image
Attachment => [

{
Filename => "testfile.jpg",
Content => ${$JPGContent},
ContentType => "image/jpg",
}

Hope you will help me to come out from the issue.


Best Regards,
Vrushali
zzz
OTRS superhero
Posts: 777
Joined: 15 Dec 2016, 15:13
Znuny / OTRS Version: 3.x–6.0.x
Real Name: Emin
Company: Efflux GmbH
Contact:

Re: How to attach jpg image which creating ticket

Post by zzz »

Hello Vrushali,

Not quite sure what you're trying to do, but are you aware of template attachments?
Docs

Best regards
Emin
Professional OTRS, Znuny & OTOBO services: efflux.de | efflux.de/en/

Free and premium add-ons: German | English
vrushaligave
OTRS newbie
Posts: 3
Joined: 07 May 2021, 08:45
Znuny / OTRS Version: OTRS 6
Real Name: Vrushali Gave

Re: How to attach jpg image which creating ticket

Post by vrushaligave »

@Emin

I'm raising the OTRS ticket through the API calls. The code I have mentioned is for the OTRS attachment. Using that code I'm unable to see the image after downloading an attachment.

I'm looking forward to solving this error ASAP
jojo
OTRS Employee
Posts: 14910
Joined: 26 Jan 2007, 14:50
Znuny / OTRS Version: Git Master
Contact:

Re: How to attach jpg image which creating ticket

Post by jojo »

the base64 you posted is a gif file with only some bytes....
"Production": OTRS™ 8, OTRS™ 7, STORM powered by OTRS
"Testing": ((OTRS Community Edition)) and git Master

Never change Defaults.pm! :: Blog
Professional Services:: http://www.otrs.com :: enjoy@otrs.com
zzz
OTRS superhero
Posts: 777
Joined: 15 Dec 2016, 15:13
Znuny / OTRS Version: 3.x–6.0.x
Real Name: Emin
Company: Efflux GmbH
Contact:

Re: How to attach jpg image which creating ticket

Post by zzz »

A free forum is a bad place for ASAP help. You might consider professional support if it's urgent.

First, your ContentType is wrong. It should be 'image/jpeg'. Also, as jojo mentioned, the content should match the content type.

— Emin
Professional OTRS, Znuny & OTOBO services: efflux.de | efflux.de/en/

Free and premium add-ons: German | English
root
Administrator
Posts: 2737
Joined: 18 Dec 2007, 12:23
Znuny / OTRS Version: Znuny LTS and 4/5/6
Real Name: Roy Kaldung
Company: Znuny
Contact:

Re: How to attach jpg image which creating ticket

Post by root »

vrushaligave wrote: 07 May 2021, 14:32 I'm looking forward to solving this error ASAP
Hi,

Check the marketplace for ASAP solutions, this forum is run by volunteers in their spare time without any financial compensation.

- Roy
Znuny LTS and ((OTRS) Community Edition CentOS / RHEL / Debian / SLES / MySQL / PostgreSQL / Oracle / OpenLDAP / Active Directory / SSO

Use a test system - always.

Do you need professional services? Check out https://www.znuny.com/

Do you want to contribute or want to know why ?
vrushaligave
OTRS newbie
Posts: 3
Joined: 07 May 2021, 08:45
Znuny / OTRS Version: OTRS 6
Real Name: Vrushali Gave

Re: How to attach jpg image which creating ticket

Post by vrushaligave »

zzz wrote: 07 May 2021, 14:53 A free forum is a bad place for ASAP help. You might consider professional support if it's urgent.

First, your ContentType is wrong. It should be 'image/jpeg'. Also, as jojo mentioned, the content should match the content type.

— Emin


Hello,

Could you please help me to get the content? How will get the image content?

If I use this code then what will be the Content for a jpeg file?

"{""ContentType"":""image/jpeg"",""Filename"":""file.jpeg"",""Content"":"" ? ""}"
zzz
OTRS superhero
Posts: 777
Joined: 15 Dec 2016, 15:13
Znuny / OTRS Version: 3.x–6.0.x
Real Name: Emin
Company: Efflux GmbH
Contact:

Re: How to attach jpg image which creating ticket

Post by zzz »

Hey,

You're asking the wrong question. You should first have the content and the filename and then ask for the content type, but I can't tell you how to get the image content. I don't even know what exactly you're trying to do with your extension/application. There will/should be a place where the user uploads a file and in that way, you'll get the content of the image. You simply put the filename into a (most likely core) function that'll tell you the content type of the file.

If it's an OTRS extension, you can take a look at AgentTicketPhone.pm and how that module handles uploading files. If it's a third-party application, you'll have to search the internet on how to upload files in that programming language and how to extract the content type of a file.

— Emin
Professional OTRS, Znuny & OTOBO services: efflux.de | efflux.de/en/

Free and premium add-ons: German | English
Post Reply