Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Thumbnail width and height in theme.php (the actual thumb on server)  (Read 4429 times)

0 Members and 1 Guest are viewing this topic.

allvip

  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Posts: 1362

Hi.
No php function like imagesx etc works in theme.php
I need the width and height of each thumb_name.jpg.
Thanks.
Logged

allvip

  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Posts: 1362
Re: Thumbnail width and height in theme.php (the actual thumb on server)
« Reply #1 on: November 08, 2019, 08:57:45 pm »

The reason cpg_getimagesize did not work is because the thumbnail src is not the full path.
Anyway, cpg_getimagesize will give the width and height together as a string.

Solution

theme.php, theme_display_thumbnails

//get full thumnail path
$thumbImg = $thumb['image'];
preg_match('(<img[^>]* src=\"([^\"]*)\"[^>]*>)', $thumbImg, $matchesImg);
$thumbFilePath = $CONFIG['site_url'] . $matchesImg[1];   

// get width, height,attr and type
list($width, $height, $type, $attr) = getimagesize("$thumbFilePath");

then tokens to use in $template_thumbnail_view

The answer is not detailed.


Logged
Pages: [1]   Go Up
 

Page created in 0.017 seconds with 20 queries.