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: Integrating GD Library with Coppermine?  (Read 7554 times)

0 Members and 1 Guest are viewing this topic.

Frink

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Integrating GD Library with Coppermine?
« on: August 08, 2007, 07:48:40 am »

Is it possible to integrate the GD Library with Coppermine?

Here is the link to their site if it helps http://www.libgd.org/Main_Page

If it is possible to integrate the GD Library with Coppermine I would greatly appreciate any help.

« Last Edit: August 08, 2007, 09:14:33 am by GauGau »
Logged

Sami

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 3686
  • BMossavari
    • My Project
Re: Integrating GD Library with Coppermine?
« Reply #1 on: August 08, 2007, 08:51:47 am »

Coppermine already using GD library to manipulate pictures
I don't know which type of integration you are looking for ???
Logged
‍I don't answer to PM with support question
Please post your issue to related board

Frink

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: Integrating GD Library with Coppermine?
« Reply #2 on: August 08, 2007, 09:07:08 am »

Well I want to be able to update the GD Library with the up-to-date version and I don't know how to use GD's commands.   Here are the commands/codes I want to use http://search.cpan.org/~burak/GD-Thumbnail-1.10/lib/GD/Thumbnail.pm#create
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Integrating GD Library with Coppermine?
« Reply #3 on: August 08, 2007, 09:14:05 am »

Support for GD needs to be compiled into PHP - that's not something a web-driven app like coppermine can do. If you don't have GD available on your server, you'll need to talk to your webhost. As Sami suggested, Coppermine already uses GD, so your question doesn't apply. Marking this thread as "invalid" and moving it accordingly, as your question is not related to bridging. Coppermine is using the GD library to create the thumbnails and intermediate-sized images.
Please read the FAQ.
Logged

Frink

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: Integrating GD Library with Coppermine?
« Reply #4 on: August 09, 2007, 11:26:19 pm »

I should clarify this question.  I want to use these commands with Coppermine.  http://search.cpan.org/~burak/GD-Thumbnail-1.10/lib/GD/Thumbnail.pm.

Quote
   use GD::Thumbnail;
   my $thumb = GD::Thumbnail->new;
   my $raw   = $thumb->create('test.jpg', 80, 2);
   my $mime  = $thumb->mime;
   warn sprintf "Dimension: %sx%s\n", $thumb->width, $thumb->height;
   open    IMG, ">thumb.$mime" or die "Error: $!";
   binmode IMG;
   print   IMG $raw;
   close   IMG;

Quote
   my $raw = $thumb->create($image    , $max, $info);
   my $raw = $thumb->create('test.jpg',   80, 1    );


Is there a file I can put these commands in, such as the index.php, so I can use GD's thumbnail output?
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Integrating GD Library with Coppermine?
« Reply #5 on: August 10, 2007, 07:19:14 am »

Look: as suggested, Coppermine already creates the thumbnails for you. There's no need to add code to dynamically create thumbnails, as this would mean a huge waste of resources to re-create the thumbnail whenever it is needed. If you must have this code, then you'll have to figure this out on your own where exactly to apply it - I'm not going to waste hours to integrate your suggested code into the coppermine core code. Coppermine already has the needed functions as well to create a thumbnail - if you need dynamically-created thumbnails, you can use that function (although it absolutely doesn't make sense at all). Why don't you go ahead and explain why you so badly insist on having that particular piece of code reside in Coppermine. Maybe someone will come up with the needed code changes if you can explain why you need them.
Logged

Frink

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: Integrating GD Library with Coppermine?
« Reply #6 on: August 10, 2007, 10:25:20 am »

Coppermine already has the needed functions as well to create a thumbnail - if you need dynamically-created thumbnails, you can use that function (although it absolutely doesn't make sense at all).

Where is this function located? 
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Integrating GD Library with Coppermine?
« Reply #7 on: August 10, 2007, 10:35:19 am »

Search the core code - as suggested, I'm not going to look into this for you, as it is silly in the first place. You need it -> you code it. Won't answer any more questions, as you failed to do as suggested:
Why don't you go ahead and explain why you so badly insist on having that particular piece of code reside in Coppermine. Maybe someone will come up with the needed code changes if you can explain why you need them.
I'm not going to waste my time for to explain how coppermine works. If you're a skilled coder, you can find out easily. If you're not a coder, you won't be able to accomplish the hack you're after.
Logged

Frink

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: Integrating GD Library with Coppermine?
« Reply #8 on: August 10, 2007, 10:49:42 am »

Won't answer any more questions, as you failed to do as suggested:
Why don't you go ahead and explain why you so badly insist on having that particular piece of code reside in Coppermine. Maybe someone will come up with the needed code changes if you can explain why you need them.


Well I want to be able to adjust the different ways thumbnails are exported.  (Such as altering the ways generating thumbnails are made) 


I want to overlay image info, such as the size of the raw image, on the thumbnail.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Integrating GD Library with Coppermine?
« Reply #9 on: August 10, 2007, 03:55:52 pm »

Well I want to be able to adjust the different ways thumbnails are exported.  (Such as altering the ways generating thumbnails are made)
I don't understand. Please re-phrase.


I want to overlay image info, such as the size of the raw image, on the thumbnail.
This is called "watermarking" and has been covered in many threads/mods already.
Logged

Nibbler

  • Guest
Re: Integrating GD Library with Coppermine?
« Reply #10 on: August 10, 2007, 06:04:41 pm »

The code you posted is perl; you can't use perl in Coppermine as it is a php app. If you want to modify the image creation code look at resize_image() in include/picmgmt.inc.php
Logged

Frink

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: Integrating GD Library with Coppermine?
« Reply #11 on: August 13, 2007, 09:09:59 am »

The code you posted is perl; you can't use perl in Coppermine as it is a php app. If you want to modify the image creation code look at resize_image() in include/picmgmt.inc.php


Thanks Nibbler. 

I found a script which has what I want that uses GD.  But I have no clue where to put it.

Here is what it looks like...

Code: [Select]
<?php

    $i 
= new imagethumbnail_info();
    
$i->open("butterfly.jpg");
    
$i->setX(200);
    
$i->info();
    
    
header("Content-type: image/jpeg;");
    
$i->imagejpeg();

    class 
imagethumbnail {
    
        var 
$filename;
        var 
$x;
        var 
$y;
        var 
$image;
        var 
$thumbnail;

        function 
imagethumbnail() {

        }
        
        function 
open($filename) {

            
$this->filename $filename;
            
$imageinfo = array();
            
$imageinfo getimagesize($this->filename,$imageinfo);
            
            
$this->old_x $imageinfo[0];
            
$this->old_y $imageinfo[1];
                        
            switch (
$imageinfo[2]) {
                case 
"1"$this->image imagecreatefromgif($this->filename); break;
                case 
"2"$this->image imagecreatefromjpeg($this->filename); break;
                case 
"3"$this->image imagecreatefrompng($this->filename); break;
            }
            
        }

        function 
setX($x="") {
            if (isset(
$x)) { $this->$x; }
            return 
$this->x;
        }

        function 
setY($y="") {
            if (isset(
$y)) { $this->$y; }
            return 
$this->y;
        }

        function 
generate() {

            if (
$this->and $this->0) {
                
$new_x $this->x;
                
$new_y $this->y;
            } elseif (
$this->and $this->!= "") {
                
$new_x $this->x;
                
$new_y = ($this->x/$this->old_x)*$this->old_y;
            } else {
                
$new_x = ($this->y/$this->old_y)*$this->old_x;
                
$new_y $this->y;
            }

            
$this->thumbnail imagecreatetruecolor($new_x,$new_y);
            
$white imagecolorallocate($this->thumbnail,255,255,255);
            
imagefill($this->thumbnail,0,0,$white);

            
imagecopyresampled $this->thumbnail$this->image0000$new_x$new_y$this->old_x$this->old_y);

        }

        function 
imagegif($filename="") {
            if (!isset(
$this->thumbnail)) { $this->generate(); }
            
imagetruecolortopalette($this->thumbnail,0,256);
            if (
$filename=="") {
                
imagegif($this->thumbnail);
            } else {
                
imagegif($this->thumbnail,$filename);
            }
        }

        function 
imagejpeg($filename="",$quality=80) {
            if (!isset(
$this->thumbnail)) { $this->generate(); }
            
imagejpeg($this->thumbnail,$filename,$quality);
        }

        function 
imagepng($filename="") {
            if (!isset(
$this->thumbnail)) { $this->generate(); }
            if (
$filename=="") {
                
imagepng($this->thumbnail);
            } else {
                
imagepng($this->thumbnail,$filename);
            }
        }

    }

    class 
imagethumbnail_info extends imagethumbnail {

        var 
$info;
        var 
$color;

        function 
imagethumbnail_info() {
            
$this->info "";
            
$this->color "FFFFFF";
        }
        
        function 
setColor($color="") {
            if (isset(
$color)) { $this->color $color; }
            return 
$this->color;
        }

        function 
info() {

            if (!isset(
$this->thumbnail)) { $this->generate(); }
            
            
$i_x imagesx($this->thumbnail);
            
$i_y imagesy($this->thumbnail);

            
$image imagecreatetruecolor($i_x,($i_y+30));
            
$black imagecolorallocate($image,0,0,0);
            
$white imagecolorallocate($image,255,255,255);
            
imagefill($image,0,0,$black);
            
imagecopy($image,$this->thumbnail,0,0,0,0,$i_x,$i_y);
            
            
$stringlength strlen($this->old_x." by ".$this->old_y)*imagefontwidth(4);
            
            
imagestring($image,4,($i_x-$stringlength)/2,$i_y+5,$this->old_x." by ".$this->old_y,$white);
            
            
imagedestroy($this->thumbnail);

            
$this->thumbnail $image;

        }

    }
    
?>

Here is where I got the script from http://www.phpgd.com/scripts.php?script=38.

If anyone one the board can help me, it will be greatly appreciated.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Integrating GD Library with Coppermine?
« Reply #12 on: August 13, 2007, 05:38:15 pm »

As suggested various times on this thread, your request is invalid in the first place, since coppermine already comes with GD support, so there's no use in re-requesting it. Your customization requests are beyond what you can expect from regular free support, so you're on your own with this: code it by yourself or hire someone to code it for you. Please do not try to draw attention to your request that has been labelled "invalid" for good reasons by bumping it constantly to the top with code snippets taken from some place. Coming up with working code doesn't just mean copying bits of code from all over the internet and just pasting it into the corresponding sections in Coppermine. What you're up to requires in-depth understanding of coppermine, good coding skills and a lot of time to come up with the code and test it.
Additionally, you haven't done as suggested
I don't understand. Please re-phrase.
, so I'm reluctant to see this discussion continue.
Logged
Pages: [1]   Go Up
 

Page created in 0.049 seconds with 20 queries.