Certificate (plugin)

TCPDF Error: Cannot Open Image File

 
 
Picture of Ellen Kinsel
TCPDF Error: Cannot Open Image File
 

Any of the files in the pix folder that are part of the Certificate download work fine. When I create my own image, e.g., sampsig.png, and upload it, when I try to display the certificate with one of the graphics selected, I get this:

TCPDF ERROR: Can't open image file: /home/learning/moodledata/cache/tcpdf/mska_b36071b1c5fea591a0534c043083d3d4

The permissions on my graphics are identical to those included in the downloaded module.

I was successful in downloading a border image, editing it, saving it with a new name, uploading it, selecting it, and successfully displaying the certificate. It is a signature image that causes the error.

 

 
Average of ratings: -
Picture of D Barnhart
Re: TCPDF Error: Cannot Open Image File
 

Did you ever resolve this?  I am getting pretty much the same error for the seal that I added.

TCPDF ERROR: Can't open image file: /home2/autodea2/public_html/classes/moodledata/cache/tcpdf/mska_ab06cb6b020203aef3dab52d2ddf96ea

My graphics are the same as well it seems so not sure why it isn't working.

 
Average of ratings: -
Picture of Mark Nelson
Re: TCPDF Error: Cannot Open Image File
Group DevelopersGroup Documentation writersGroup Moodle HQGroup Particularly helpful MoodlersGroup Testers

Hi Guys,

Regarding the message, eg. 'TCPDF ERROR: [Image] Unable to get image: /home/accountname/moodledata/cache/tcpdf/img_5810e3e1cbe2b8ba9e54ed54e5e030df', this is not a bug in the code, but an issue with permissions in the moodledata directory. To fix you can create the directory 'tcpdf' in the moodledata/cache directory and gave it the permissions 777 (sudo chmod -R 777 tcpdf). I am not sure how many others are receiving this issue, as it is not that common. I may have to write a code fix to resolve it.

Regards,

Mark

 
Average of ratings:Useful (3)
Picture of D Barnhart
Re: TCPDF Error: Cannot Open Image File
 

Mark,

Thank you!  That was the fix.  I would have never figured that out smile

 
Average of ratings: -
Picture of Ellen Kinsel
Re: TCPDF Error: Cannot Open Image File
 

Thanks for this Mark.

What worked for me was creating the images using a different graphics program. The ones that didn't work were created using the SnagIt editor. When we switched to creating them in Paint, they worked.

We had already reviewed all permissions, but didn't know that a separate tcpdf folder was required.

 

 
Average of ratings: -
Picture of W Roes
Re: TCPDF Error: Cannot Open Image File
 

Hi Mark,

Unfortunately clearing the cache - something you do frequently when creating new certificates - deletes the cache/tcpdf folder again and this folder is not automatically created.

Has this behaviour changed in one of the recent updates because I have not seen it before but it seems to be quite persistent?

 
Average of ratings: -
Picture of Matt Porritt
Re: TCPDF Error: Cannot Open Image File
 

It is also worth noting that if using .png save it as an 8bit format.  TCPDF doesn't like 24 bit pngs

 
Average of ratings: -
Picture of Glenn Sisson
Re: TCPDF Error: Cannot Open Image File
 

Hi Mark,

FYI

I am also receiving this error.

 
Average of ratings: -
Picture of Mark Nelson
Re: TCPDF Error: Cannot Open Image File
Group DevelopersGroup Documentation writersGroup Moodle HQGroup Particularly helpful MoodlersGroup Testers
Ok, seems this is not a rare case. I will have to investigate why this is occurring. Is this happening when you use files you have uploaded via the certificate settings interface or through files you added in the mod/certificate/pix folder?
 
Average of ratings: -
Picture of W Roes
Re: TCPDF Error: Cannot Open Image File
 
Hi Mark, It's the latter. Thanks Willem
 
Average of ratings: -
Picture of David Hempy
Re: TCPDF Error: Cannot Open Image File
 

Same issue here.  Attempting to include a .gif as a seal.  Omitted the seal and all is well.

May try different formats for the seal image...

-dave

 
Average of ratings: -
Picture of Jonathan Rabson
Re: TCPDF Error: Cannot Open Image File
 

I got a similar error.  I resolved it by changing my signature PNG file to have a white background instead of transparent (since my certificate background is white anyway).  The default signature that comes with the plugin has a transparent background, but for some reason it didn't accept my image unless the background was white.

 
Average of ratings: -
Picture of Mark Nelson
Re: TCPDF Error: Cannot Open Image File
Group DevelopersGroup Documentation writersGroup Moodle HQGroup Particularly helpful MoodlersGroup Testers

Hi Guys,

Please view https://tracker.moodle.org/browse/CONTRIB-4089 to keep updated on my progress of producing a fix for this.

Regards,

Mark

 
Average of ratings: -
Picture of Rafał Korzeniewski
Re: TCPDF Error: Cannot Open Image File
 

Hello Mark, hello Everyone

Today I met with this problem in both situation (ftp, and moodle interface)

After several attempts I cleared the browser(chrome) cache 

It looks like it's helped

Regards,

Rafał

 

 
Average of ratings: -
Picture of Robert Russo
Re: TCPDF Error: Cannot Open Image File
 

Change in certificate.php

$pdf = new TCPDF(BLAH BLAH);

to

$pdf = new PDF(BLAH BLAH);

in the relevant page /type/ folders.

 

 
Average of ratings: -
Picture of Constance Horne
Re: TCPDF Error: Cannot Open Image File
 

Thanks for the code change info. That made it work for me!

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: TCPDF Error: Cannot Open Image File
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

Thanks. That fixes it for us too. smile

 
Average of ratings: -
Picture of Boaz Neeman_Golan
Re: TCPDF Error: Cannot Open Image File
 

I created a durectory named it TCPDF within Moodledata/cache, and gave it 755 permission level - it solved the issue as well smile

 
Average of ratings: -
Picture of Mark Nelson
Re: TCPDF Error: Cannot Open Image File
Group DevelopersGroup Documentation writersGroup Moodle HQGroup Particularly helpful MoodlersGroup Testers

This issue has been resolved in the latest certificate version, please obtain it from https://github.com/markn86/moodle-mod_certificate - thanks for all your help and patience.

 
Average of ratings:Useful (2)
Picture of Adi Tedjasaputra
Re: TCPDF Error: Cannot Open Image File
 

Well done Mark!

 
Average of ratings: -
Picture of Mark Nelson
Re: TCPDF Error: Cannot Open Image File
Group DevelopersGroup Documentation writersGroup Moodle HQGroup Particularly helpful MoodlersGroup Testers

Hehe, thanks Adi! Long time no see, hope all is going well mate.

 
Average of ratings:Useful (1)