dynamic thumbnailing ?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • .: DeVa :.

    dynamic thumbnailing ?

    Need recomendation for script that would dynamicly create thumbnails from
    pictures in certain directory, and automaticly genreate link to original
    pictures...

    Tuts are also welcom...

    TNX.

    ------


    "Half-brother in blood,
    full brother in heart will I be.
    Thou shalt lead and I will follow.
    May no new grief divide us."

    Valar morghulis!
    --
    Remove all FAKEs when replying to mail !





  • Terence

    #2
    Re: dynamic thumbnailing ?

    look for some php photo-album software and review their source-code. I
    worked it out by reading the php manual (image functions).

    here's a function I wrote some time ago (for a photo album program of my
    own). It tries to use a function called imageCopyResamp led() but falls
    back to imageCopyResize d(). The newer function imageCopyResamp led()
    gives better quality but not all version of GD PHP modules have it.

    You will have to modify this function as it was designed for my app. The
    main param you are interested in is $intSize which represents the
    maximum length of the longest side you want the thumbnail to be.

    function createThumbnail ($id,$idSrcImg, $intSize) {

    $uriSrcDir = "../albums".$id."/";
    $uriSrcImg = $uriSrcDir.$idS rcImg;
    $uriThmImg = $uriSrcDir."_th umbs/".$idSrcImg ;

    $imgSrc=imagecr eatefromjpeg($u riSrcImg);

    $intSrcH = ImageSY($imgSrc );
    $intSrcW = ImageSX($imgSrc );
    if($intSrcH == $intSrcW) {
    $intHeight = $intWidth = $intSize;
    }
    elseif($intSrcH > $intSrcW) {
    $intHeight = $intSize;
    $intWidth = ceil(($intSrcW/$intSrcH) * $intSize);
    }
    else {
    $intWidth = $intSize;
    $intHeight = ceil(($intSrcH/$intSrcW) * $intSize);
    }

    $imgThm=imagecr eate($intWidth, $intHeight);

    if(
    !@imageCopyResa mpled(
    $imgThm,
    $imgSrc,
    0,
    0,
    0,
    0,
    $intWidth,
    $intHeight,
    $intSrcW,
    $intSrcH
    )
    ) {
    imageCopyResize d(
    $imgThm,
    $imgSrc,
    0,
    0,
    0,
    0,
    $intWidth,
    $intHeight,
    $intSrcW,
    $intSrcH
    );
    }

    Comment

    • Terence

      #3
      Re: dynamic thumbnailing ?

      re: revious example code:
      forgot to include a closing brace in all the excitement...

      Comment

      • .: DeVa :.

        #4
        Re: dynamic thumbnailing ?

        Tnx. I will take a look at your code and refer to manual, im sure I'l manage
        something..

        Cheers....

        ------


        "Half-brother in blood,
        full brother in heart will I be.
        Thou shalt lead and I will follow.
        May no new grief divide us."

        Valar morghulis!
        --
        Remove all FAKEs when replying to mail !



        Terence natipkase:[color=blue]
        > re: revious example code:
        > forgot to include a closing brace in all the excitement...[/color]


        Comment

        • kaptain kernel

          #5
          Re: dynamic thumbnailing ?



          but i found it easier to use ImageMagick's convert tool, called via an
          exec() in my thumbnailing script.


          ..: DeVa :. wrote:
          [color=blue]
          > Need recomendation for script that would dynamicly create thumbnails from
          > pictures in certain directory, and automaticly genreate link to original
          > pictures...
          >
          > Tuts are also welcom...
          >
          > TNX.
          >
          > ------
          > www.podvodni-svijet.com
          >
          > "Half-brother in blood,
          > full brother in heart will I be.
          > Thou shalt lead and I will follow.
          > May no new grief divide us."
          >
          > Valar morghulis!
          > --
          > Remove all FAKEs when replying to mail ![/color]

          Comment

          Working...