calculate image size in a2-a6 formats

images php coding issues or problems here.

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 32
Joined: Sun Mar 30, 2014 4:45 am

Sat Apr 30, 2016 2:58 am

Hi all,
I have some kind of image editor written using php/javascript, which is based on fabricjs library ( and admin, logged to site has to select a2-a6 formats and orientation as portrait / landscape.
Here I see that size of image depends not only from selected format and orientation, but also from monitor of admin.

Here there is DPI Calculator / PPI Calculator, say on my side it is 115.942, as I have laptop 19 inch, Resolution : 1920x1080 pixels

The question is how to calculate width and height of generated image?
That is known that size in mm = pixels * pixels in 1mm.

We can not calculate programmatically ppi value by using javascript... Is it so?

Admin MUST KNOW it... say in image editor show link to dpi/ppi Calculator and admin can get it there and enter this value in.
After admin selected his ppi value by data in table programm must to select valid width/height in pixels, say as example
a5/portrait for my 115.94 PPI I must get 874 x 1240 pixels, as I need to get right column(3rd column) from range of my ppi. Is it so?
Entering all data template of image with all parameters is saved and image is generated.
Question is if admin reopens this template(maybe on ther device) with generated image has he enter his ppi of this devices and recalculate the image size again?

Thanks for advice!

User avatar
php-forum Fan User
php-forum Fan User
Posts: 526
Joined: Mon Feb 22, 2016 5:52 pm

Sat Apr 30, 2016 8:27 am

Paper which is A2 to A6 in size is fixed, orientation changes since the paper is divided by 2 (folded in half).

The size of paper has nothing to do with the size of your device or its screen or the window within.

Are you trying to print the images on paper?

Post Reply