Need to store image size in DB

Phoca Gallery - image gallery extension
Matysh
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 17 Jan 2017, 15:20

Need to store image size in DB

Post by Matysh » 16 Oct 2019, 08:45

Hi!
I use phoca gallery component several years and it is awesome! Thanks!
I display the gallery on my website (example) with jquery mosaic - it is cool plugin to display gallery. But I need to know width and height for every image. Now, I take it with with getimagesize, but I think that it is non optimal way. Can we store width and height for every image in DB? May be you can do it with next update, I hope it is fast and easy, but useful feature.

User avatar
KarEm
Phoca Professional
Phoca Professional
Posts: 117
Joined: 20 Dec 2015, 21:25

Re: Need to store image size in DB

Post by KarEm » 16 Oct 2019, 13:48

Hi,
just out of interest, for what purpose do you need, I suspect the values of the thumbs?

Regards
KarEm

User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 41852
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Need to store image size in DB

Post by Jan » 16 Oct 2019, 13:57

Another question, which size you need to know - size of the thumbnail or size of the original image?

The size of thumbnail is stored in database in columns: extw, exth:

Image

where the ordering is large thumbnail, medium thumbnail, small thumbnail
If you find Phoca extensions useful, please support the project

Matysh
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 17 Jan 2017, 15:20

Re: Need to store image size in DB

Post by Matysh » 16 Oct 2019, 14:05

KarEm
1. For mosaic plugin (there is enough aspect ratio, so we need width and height to calculate it. In fact, size of thumbnails enough for it)
2. For photoswipe plugin we need attribute data-sizes for correct scaling.
It is only my reasons, I think there are many other cases for any big and complex website. F.e. to display original sizes for users.

Jan
I talk about size of original images.

Matysh
Phoca Newbie
Phoca Newbie
Posts: 5
Joined: 17 Jan 2017, 15:20

Re: Need to store image size in DB

Post by Matysh » 16 Oct 2019, 14:13

Jan
I don't know why, but for most images in my DB fields 'extw' and 'exth' is empty o_O.
I'm always add new images via Multiple add.

Update:
This fields stay filled after "recreate thumbnails" for this image.

User avatar
Jan
Phoca Hero
Phoca Hero
Posts: 41852
Joined: 10 Nov 2007, 18:23
Location: Czech Republic
Contact:

Re: Need to store image size in DB

Post by Jan » 21 Oct 2019, 15:52

Ok, maybe the images were added on your server before the function to store these values was introduced. :idea:

Jan
If you find Phoca extensions useful, please support the project

Post Reply