Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: image information  (Read 3856 times)

0 Members and 1 Guest are viewing this topic.

utw

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
image information
« on: July 28, 2007, 02:20:23 pm »

Hi,
I need to show image's dimension in centimeters (millimeters, metrical value ;) ) rather than in pixel in image's description box.
Is there any chance to do it? I take a look of the php code (editOnePic.php) but I cannot find anything. Maybe a plugin can help me?

Thanks a lot !

utw
« Last Edit: August 24, 2007, 08:40:34 am by GauGau »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: image information
« Reply #1 on: July 29, 2007, 01:12:48 pm »

Basically, there is no correlation between pixels and dimensions in centimeters, as this will depends on the resolution (dots per inch) and the output medium (print or screen). As Coppermine is not "aware" of the resolution (dots per inch), you can only come up with an actual calculation if you know the resolution of your files, i.e. if you're the only uploader. Subsequently, I suggest to review the overall idea.

Anyway, the formula is: Pixels to Inches: inches = pixels / dpi. The formula to convert inches to centimeters is: cm = inches * 2.54. Subsequently, the formula to convert pixels to centimeters is: cm = (pixels * 2.54) / dpi.
So if you know that all your images are e.g. 96dpi, you could come up with a working formula in PHP, which would roughly look like this (untested) piece of code:
Code: [Select]
<?php
$dotsPerInch 
96;
$inchToCentimeterRatio 2.54;
$numberOfDecimals 2;
$dimensionInCentimeters floor( ( ($dimensionInPixels $inchToCentimeterRatio) / $dotsPerInch) * pow(10,$numberOfDecimals) ) / pow(10,$numberOfDecimals);
You will have to modify the function html_picinfo() in displayimage.php integrate this into Coppermine.
Logged

utw

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: image information
« Reply #2 on: July 29, 2007, 05:55:19 pm »

Hi Gau Gau and thanks for your reply!
I appreciate your solution: I can also implement a pop-up from which you choose the right resolution in dpi and then display the correct size.
Or can coppermine guess the dpi from the file, in the way photoshop does?

Thank you.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: image information
« Reply #3 on: July 30, 2007, 07:51:27 am »

Afaik there's no function in PHP's GD commands to determine this. If you have ImageMagick available, there might be a solution.
Logged

utw

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: image information
« Reply #4 on: August 08, 2007, 12:06:32 pm »

Yes, I've got ImageMagick.
Could it be this an issue important for other users? i.e. should I post it in other forum's area rather than this?
Thanks!
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: image information
« Reply #5 on: August 08, 2007, 01:56:06 pm »

Yes, I've got ImageMagick.
Then there's a chance that you could come up with some custom code to accomplish what you're up to. You'll need good coding skills though.

Could it be this an issue important for other users?
Possible, but unlikely imo.
should I post it in other forum's area rather than this?
No. If we wanted this thread in another sub-board, we would have moved it there. Please stick to this thread.
Logged

utw

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: image information
« Reply #6 on: August 23, 2007, 11:35:59 pm »

hi then and sorry for my late reply, but I went on vacation :)
the feature I was talking about was requested me by people interested in using coppermine as a tool to organize images (i.e. an archive).
while these images will be used in books or something that will be published on paper, you can realize how I (and they) need to know such informations.
In the meantime, I try to code something by myself or, better, getting helped by developers/coders...
Thanks for your kind replies!
Logged
Pages: [1]   Go Up
 

Page created in 0.022 seconds with 19 queries.