DaDaBIK
This forum is devoted to the discussion about the software DaDaBIK database front-end
the PHP Database application generator for MySQL, PostgreSQL, SQLite and MS SQL Server; also available for Wordpress.

TCPDF ERROR: [Image] Unable to get the size of the image
April 28, 2020 11:49AM
Hi,

I get the following error when trying to produce a PDF (using the "No PDF template" default setting)::

TCPDF ERROR: [Image] Unable to get the size of the image: https://mywebsite.com/index.php?r=1588073829&function=show_file&file_type=image_file&tablename=tblClients&tablename_original=tblClients&file_field_name=fldImageWinFront&master_table_name=&is_items_table=0&where_field=fldClientID&where_value=4

The image (it is one of several image fields in the table) the error refers to is the first image in my table. The images display fine in grid, edit and details view.

Uploading images usually works OK (see exception below) and images are being stored in the upload folder correctly. I believe I have the correct settings in config for $upload_directory and $upload_relative_url. Any ideas what could be causing this?

EXCEPTION for images uploading correctly: I do have a problem when trying to upload images from my iPhone. If I choose "select image from library" the upload fails and I get the "An error occurred when uploading a file" error. This error doesn't occur if I actually take an image with the phones camera and upload it immediately. But any image I try to upload already in my image library on my phone fails. Any ideas what could be cauing this?

I have all the correct settings in config, including file types and paths etc, and as I say, it works fine with new images just taken, and also works fine on my desktop computer with existing images.

You are using DaDaBIK version 10.1-Manarola enterprise, installed on 04-27-2020 (installation code: 154545ea6b612ec5e9), the latest version of DaDaBIK is 10.1-Manarola released on 03-09-2020

You are running the last release of DaDaBIK

In case you want to upgrade to a more powerful edition (from Pro to Enterprise/Platinum, from Enterprise to Platinum) please contact us.

System info
PHP Version: 7.0.33
mysql version: 5.5.5-10.2.29-MariaDB-log
Web server: Apache

Client: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.113 Safari/537.36
Re: TCPDF ERROR: [Image] Unable to get the size of the image
April 29, 2020 10:42AM
Hello,
about the first problem: have you set $site_url and $site_path? Those parameters are often the origin of this error.
You should try to leave them blank and only if you get this error or if DaDaBIK redirects to the wrong page after login you should fill them.

About the second problem: I haven't heard about similar problems before, have you ever tried with other forms containing uploads? Does your iphone work?

Best,

________________________________________________________
Eugenio |\.-./| DaDaBIK founder
Re: TCPDF ERROR: [Image] Unable to get the size of the image
April 30, 2020 06:08AM
Hi Eugenio,

Many thanks for the reply.

I tried all variations of $site_url & $site_path - both blank, both completed, one blank and the other completed. Nothing made any difference, still the same error every time.

My site (which has a Let's Encrypt SSL cert installed) is installed in the root directory, so I have the following settings when both completed:

$site_url = 'https://mywebsite.com/';;

$site_path = '/';

Strangely, I did find a way to avoid the error and get the PDF to create (although it didn't contain any of the images), by omitting the trailing slash from the site url (i.e. $site_url = 'https://mywebsite.com';;), but then this obviously breaks the site as soon as a url change/redirect occurs.

Also maybe worth noting is that the URL referenced in any error actually opens the image correctly when copied and pasted into the browser e.g.

https://mywebsite.com/index.php?r=1588214922&function=show_file&file_type=image_file&tablename=tblClients&tablename_original=tblClients&file_field_name=fldImageWinFront&master_table_name=&is_items_table=0&where_field=fldClientID&where_value=11

Any other ideas?

Re the second problem with iphone images; I think I figured it out - some photos on my iphone are saved with file extension as "jpeg", not "jpg", so I just needed to include a new file extension type and mime in config.php:

$allowed_file_exts_mime_ar[13] = 'image/jpeg';

$allowed_file_exts_ar[13] = 'jpeg';

I suppose this could be added as standard in the next Dadabik release - I'm surprised nobody has mentioned this problem before though (maybe they just figured it out more quickly!).

Thanks,
Matt



Edited 1 time(s). Last edit at 04/30/2020 06:13AM by meanster99.
Re: TCPDF ERROR: [Image] Unable to get the size of the image
May 02, 2020 08:45AM
Hello,
ok, is it possible to try to temporary disable authentication ($enable_authentication = 0)? If it works, at least we know that the problem is related to a lost session.

Best,

________________________________________________________
Eugenio |\.-./| DaDaBIK founder
Re: TCPDF ERROR: [Image] Unable to get the size of the image
May 02, 2020 09:01AM
Hi Eugenio,

Yes, that is it! disabling authentication has fixed the problem. So what do I need to do to make it work with authentication enabled please?

Thanks,
Matt
Re: TCPDF ERROR: [Image] Unable to get the size of the image
May 02, 2020 09:20AM
Ok, this means that when TCPDF calls the URLs to get the images, for some reason PHP sees those calls as coming from another browser session.

Two questions:

1) Have you changed any dadabik file (tcpdf.php or other files) except from config.php?

2) Are you working locally or on a hosting server? Are you aware of any particular security filter your hosting provider is using?

Best,

________________________________________________________
Eugenio |\.-./| DaDaBIK founder
Re: TCPDF ERROR: [Image] Unable to get the size of the image
May 02, 2020 09:34AM
Hi Eugenio,

1. No
2. On a hosting server. Not aware of any security filters, but I'm going to email them now to see if they know anything about what could be causing it. Is there anything in particular I should ask? I was just going to explain that when TCPDF calls the URLs to get the images, for some reason PHP sees those calls as coming from another browser session.

Thanks,
Matt
Re: TCPDF ERROR: [Image] Unable to get the size of the image
May 02, 2020 10:31AM
OK. Before submitting a request, If you can test the same application locally on your computer, I would do that ... I am 99% sure that the problem will disappear locally, but if you can test it at least you have the proof.

Best,

________________________________________________________
Eugenio |\.-./| DaDaBIK founder
Re: TCPDF ERROR: [Image] Unable to get the size of the image
May 02, 2020 10:38AM
Hi Eugenio,

My host came back to me with this:

Loopback request are handled by different web servers for security and performance reason, it sounds like they just need to be able to access PHP session from different web servers in our network. As standard PHP session management uses /tmp, so they aren't accessible by different servers sitting behind load balancers on cloud platforms like ours (and those like AWS etc.)

The best way to do this is to create a directory at the root of the webspace called ".sessions"

You can then add a .user.ini file in the webspace to tell PHP to use it for its sessions:

session.save_path=/home/sites/10c/e/e3b2ed1123/.sessions

When you do this, any new sessions will live inside your webspace so no matter the web server that handles the request, session access is always possible.

I followed their instruction but it doesn't allow me to login to Dadabik now. I'm guessing I still need to do something at the Dadabik end now?



Edited 1 time(s). Last edit at 05/02/2020 10:39AM by meanster99.
Re: TCPDF ERROR: [Image] Unable to get the size of the image
May 02, 2020 10:59AM
Please ignore my last message Eugenio - I hadn't put the sessions folder in the root directory (I put it in the public_html folder. Duh!). This all seems to be working now.

Many thanks for your patience and expertise in troubleshooting.

Thanks,
Matt
Re: TCPDF ERROR: [Image] Unable to get the size of the image
May 02, 2020 11:30AM
Interesting, they gave you a very precise and accurate answer, which is not something we can take for granted these days when we ask for technical support to hosting providers.

I would just double check the security implications: that .sessions folder (and the files contained) SHOULD NOT be accessible from the Web for obvious security reasons.

You are welcome.

Best,

________________________________________________________
Eugenio |\.-./| DaDaBIK founder
Re: TCPDF ERROR: [Image] Unable to get the size of the image
May 03, 2020 08:51AM
Because the sessions folder is in the root directory and not the public_html, it's completely inaccessible from the web, so should be relatively secure. For anyone that cares, I use 20i as my host - they are a smaller UK outfit but have very good customer service, which is what I base most of my purchase decisions on. The same reason I chose Dadabik over its competitors (although I haven't always been the best customer, hey Eugenio?! winking smiley )
Re: TCPDF ERROR: [Image] Unable to get the size of the image
May 03, 2020 07:00PM
meanster99 Wrote:
-------------------------------------------------------
>For anyone that cares, I use 20i as my host - they are a smaller UK outfit but have very good customer service

I was going to ask that very question as I am lokking for a new host!
Sorry, only registered users may post in this forum.

Click here to login