another imagejpeg question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Yang Li Ke

    another imagejpeg question

    Hi guys,
    Im trying to use this code that I found on php.net to create a thumbnail
    from an image but it simply displays a black square.
    Anyone can tell me what am I doing wrong?

    <?

    function ImageCopyResamp leBicubic(&$dst , &$src, $dstx, $dsty, $srcx, $srcy,
    $w, $h, $zoomX, $zoomY = '') {
    if (!$zoomY) $zoomY = $zoomX;
    $palsize = ImageColorsTota l($src);
    for ($i = 0; $i<$palsize; $i++) {
    $colors = ImageColorsForI ndex($src, $i);
    ImageColorAlloc ate($dst, $colors['red'], $colors['green'],
    $colors['blue']);
    }

    $zoomX2 = (int)($zoomX/2);
    $zoomY2 = (int)($zoomY/2);

    $dstX = imagesx($dst);
    $dstY = imagesy($dst);
    $srcX = imagesx($src);
    $srcY = imagesy($src);

    for ($j = 0; $j<($h-$dsty); $j++) {
    $sY = (int)($j*$zoomY )+$srcy;
    $y13 = $sY+$zoomY2;
    $dY = $j+$dsty;

    if (($sY >= $srcY) or ($dY >= $dstY) or ($y13 >= $srcY)) break 1;

    for ($i = 0; $i<($w-$dstx); $i++) {
    $sX = (int)($i*$zoomX )+$srcx;
    $x34 = $sX+$zoomX2;
    $dX = $i+$dstx;

    if (($sX >= $srcX) or ($dX >= $dstX) or ($x34 >= $srcX))
    break 1;

    $c1 = ImageColorsForI ndex($src, ImageColorAt($s rc, $sX,
    $y13));
    $c2 = ImageColorsForI ndex($src, ImageColorAt($s rc, $sX,
    $sY));
    $c3 = ImageColorsForI ndex($src, ImageColorAt($s rc, $x34,
    $y13));
    $c4 = ImageColorsForI ndex($src, ImageColorAt($s rc, $x34,
    $sY));

    $r = ($c1['red']+$c2['red']+$c3['red']+$c4['red'])/4;
    $g = ($c1['green']+$c2['green']+$c3['green']+$c4['green'])/4;
    $b = ($c1['blue']+$c2['blue']+$c3['blue']+$c4['blue'])/4;

    ImageSetPixel($ dst, $dX, $dY, ImageColorClose st($dst, $r, $g,
    $b));
    }
    }
    }
    header ("content-type: image/jpeg");
    $sourceimg = imagecreatefrom jpeg ("temp.jpg") ;
    $destimg = imagecreate (211, 300);
    ImageCopyResamp leBicubic($dest img, $sourceimg, 0, 0, 0, 0, 422,600, 211,
    300);
    imagejpeg ($destimg);
    ?>

    --



  • CountScubula

    #2
    Re: another imagejpeg question

    thats a lot of work to make a thumbnail, look into the php manual at the
    imagecopyresize d function

    --
    Mike Bradley
    http://www.gzentools.com -- free online php tools
    "Yang Li Ke" <yanglike@sympa tico.ca> wrote in message
    news:OtfXb.2121 5$y07.674381@ne ws20.bellglobal .com...[color=blue]
    > Hi guys,
    > Im trying to use this code that I found on php.net to create a thumbnail
    > from an image but it simply displays a black square.
    > Anyone can tell me what am I doing wrong?
    >
    > <?
    >
    > function ImageCopyResamp leBicubic(&$dst , &$src, $dstx, $dsty, $srcx,[/color]
    $srcy,[color=blue]
    > $w, $h, $zoomX, $zoomY = '') {
    > if (!$zoomY) $zoomY = $zoomX;
    > $palsize = ImageColorsTota l($src);
    > for ($i = 0; $i<$palsize; $i++) {
    > $colors = ImageColorsForI ndex($src, $i);
    > ImageColorAlloc ate($dst, $colors['red'], $colors['green'],
    > $colors['blue']);
    > }
    >
    > $zoomX2 = (int)($zoomX/2);
    > $zoomY2 = (int)($zoomY/2);
    >
    > $dstX = imagesx($dst);
    > $dstY = imagesy($dst);
    > $srcX = imagesx($src);
    > $srcY = imagesy($src);
    >
    > for ($j = 0; $j<($h-$dsty); $j++) {
    > $sY = (int)($j*$zoomY )+$srcy;
    > $y13 = $sY+$zoomY2;
    > $dY = $j+$dsty;
    >
    > if (($sY >= $srcY) or ($dY >= $dstY) or ($y13 >= $srcY)) break[/color]
    1;[color=blue]
    >
    > for ($i = 0; $i<($w-$dstx); $i++) {
    > $sX = (int)($i*$zoomX )+$srcx;
    > $x34 = $sX+$zoomX2;
    > $dX = $i+$dstx;
    >
    > if (($sX >= $srcX) or ($dX >= $dstX) or ($x34 >= $srcX))
    > break 1;
    >
    > $c1 = ImageColorsForI ndex($src, ImageColorAt($s rc, $sX,
    > $y13));
    > $c2 = ImageColorsForI ndex($src, ImageColorAt($s rc, $sX,
    > $sY));
    > $c3 = ImageColorsForI ndex($src, ImageColorAt($s rc, $x34,
    > $y13));
    > $c4 = ImageColorsForI ndex($src, ImageColorAt($s rc, $x34,
    > $sY));
    >
    > $r = ($c1['red']+$c2['red']+$c3['red']+$c4['red'])/4;
    > $g =[/color]
    ($c1['green']+$c2['green']+$c3['green']+$c4['green'])/4;[color=blue]
    > $b = ($c1['blue']+$c2['blue']+$c3['blue']+$c4['blue'])/4;
    >
    > ImageSetPixel($ dst, $dX, $dY, ImageColorClose st($dst, $r,[/color]
    $g,[color=blue]
    > $b));
    > }
    > }
    > }
    > header ("content-type: image/jpeg");
    > $sourceimg = imagecreatefrom jpeg ("temp.jpg") ;
    > $destimg = imagecreate (211, 300);
    > ImageCopyResamp leBicubic($dest img, $sourceimg, 0, 0, 0, 0, 422,600, 211,
    > 300);
    > imagejpeg ($destimg);
    > ?>
    >
    > --
    >
    >
    >[/color]


    Comment

    • Yang Li Ke

      #3
      Re: another imagejpeg question

      Hi CountScubula,

      Thank you very much for always helping me out with my problems.
      I tried that imagcopyresized already before I even tried those other
      sample codes from php.net but the quality generated from a imagecopyresize d
      is really ugly. So this is why im trying to find somethingelse.

      Do you have any ideas?
      --
      Yang

      "CountScubu la" <me@scantek.hot mail.com> wrote in message
      news:yZfXb.2498 3$nD3.19352@new ssvr25.news.pro digy.com...[color=blue]
      > thats a lot of work to make a thumbnail, look into the php manual at the
      > imagecopyresize d function
      >
      > --
      > Mike Bradley
      > http://www.gzentools.com -- free online php tools
      > "Yang Li Ke" <yanglike@sympa tico.ca> wrote in message
      > news:OtfXb.2121 5$y07.674381@ne ws20.bellglobal .com...[color=green]
      > > Hi guys,
      > > Im trying to use this code that I found on php.net to create a thumbnail
      > > from an image but it simply displays a black square.
      > > Anyone can tell me what am I doing wrong?
      > >
      > > <?
      > >
      > > function ImageCopyResamp leBicubic(&$dst , &$src, $dstx, $dsty, $srcx,[/color]
      > $srcy,[color=green]
      > > $w, $h, $zoomX, $zoomY = '') {
      > > if (!$zoomY) $zoomY = $zoomX;
      > > $palsize = ImageColorsTota l($src);
      > > for ($i = 0; $i<$palsize; $i++) {
      > > $colors = ImageColorsForI ndex($src, $i);
      > > ImageColorAlloc ate($dst, $colors['red'], $colors['green'],
      > > $colors['blue']);
      > > }
      > >
      > > $zoomX2 = (int)($zoomX/2);
      > > $zoomY2 = (int)($zoomY/2);
      > >
      > > $dstX = imagesx($dst);
      > > $dstY = imagesy($dst);
      > > $srcX = imagesx($src);
      > > $srcY = imagesy($src);
      > >
      > > for ($j = 0; $j<($h-$dsty); $j++) {
      > > $sY = (int)($j*$zoomY )+$srcy;
      > > $y13 = $sY+$zoomY2;
      > > $dY = $j+$dsty;
      > >
      > > if (($sY >= $srcY) or ($dY >= $dstY) or ($y13 >= $srcY))[/color][/color]
      break[color=blue]
      > 1;[color=green]
      > >
      > > for ($i = 0; $i<($w-$dstx); $i++) {
      > > $sX = (int)($i*$zoomX )+$srcx;
      > > $x34 = $sX+$zoomX2;
      > > $dX = $i+$dstx;
      > >
      > > if (($sX >= $srcX) or ($dX >= $dstX) or ($x34 >= $srcX))
      > > break 1;
      > >
      > > $c1 = ImageColorsForI ndex($src, ImageColorAt($s rc, $sX,
      > > $y13));
      > > $c2 = ImageColorsForI ndex($src, ImageColorAt($s rc, $sX,
      > > $sY));
      > > $c3 = ImageColorsForI ndex($src, ImageColorAt($s rc, $x34,
      > > $y13));
      > > $c4 = ImageColorsForI ndex($src, ImageColorAt($s rc, $x34,
      > > $sY));
      > >
      > > $r = ($c1['red']+$c2['red']+$c3['red']+$c4['red'])/4;
      > > $g =[/color]
      > ($c1['green']+$c2['green']+$c3['green']+$c4['green'])/4;[color=green]
      > > $b = ($c1['blue']+$c2['blue']+$c3['blue']+$c4['blue'])/4;
      > >
      > > ImageSetPixel($ dst, $dX, $dY, ImageColorClose st($dst, $r,[/color]
      > $g,[color=green]
      > > $b));
      > > }
      > > }
      > > }
      > > header ("content-type: image/jpeg");
      > > $sourceimg = imagecreatefrom jpeg ("temp.jpg") ;
      > > $destimg = imagecreate (211, 300);
      > > ImageCopyResamp leBicubic($dest img, $sourceimg, 0, 0, 0, 0, 422,600, 211,
      > > 300);
      > > imagejpeg ($destimg);
      > > ?>
      > >
      > > --
      > >
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • CountScubula

        #4
        Re: another imagejpeg question

        "Yang Li Ke" <yanglike@sympa tico.ca> wrote in message
        news:2lgXb.2123 3$y07.680282@ne ws20.bellglobal .com...[color=blue]
        > Hi CountScubula,
        >
        > Thank you very much for always helping me out with my problems.
        > I tried that imagcopyresized already before I even tried those other
        > sample codes from php.net but the quality generated from a[/color]
        imagecopyresize d[color=blue]
        > is really ugly. So this is why im trying to find somethingelse.
        >
        > Do you have any ideas?
        > --
        > Yang
        >[/color]

        First, your welcome :) (flattery will get you everywhere)

        I understand that copyresized is not a resample, but I haven't had many
        issues (actauly none) where quality is an issue, is it the resample or
        output quality that is buggin you?

        try
        imagejpeg($im," ",90);

        where $im = your source image after copyresized()

        I am using copyresized on this site: http://www.hairreview.com (my pet
        project), well I am using my gzImage functions.

        there is a copyresampled function, I do not know if it is compiled in for
        you, but give it a shot.



        --
        Mike Bradley
        http://www.gzentools.com -- free online php tools


        Comment

        • Yang Li Ke

          #5
          Re: another imagejpeg question

          Hi Count :)
          [color=blue]
          > I understand that copyresized is not a resample, but I haven't had many
          > issues (actauly none) where quality is an issue, is it the resample or
          > output quality that is buggin you?[/color]

          It's the output quality. the resamble is ok.

          See here is an example



          original image is here:



          I used this code:

          function thumbnail ($src, $maxv) {
          $size = @getimagesize ($src);
          if(($size[0] < $maxv)&&($size[1] < $maxv)){
          $newx = $size[0];
          $newy = $size[1];
          }else{
          if($size[0] > $size[1]){
          $newx = intval ($maxv);
          $newy = intval ($size[1] * ($maxv / $size[0]));
          }else{
          $newy = intval ($maxv);
          $newx = intval ($size[0] * ($maxv / $size[1]));
          }
          }
          $destimg = imagecreate ($newx, $newy );
          $sourceimg = imagecreatefrom jpeg ($src);
          imagecopyresize d ($destimg, $sourceimg, 0,0,0,0, $newx, $newy, $size[0],
          $size[1]);
          header ("content-type: image/jpeg");
          imagejpeg ($destimg,"",10 0);
          imagedestroy ($destimg);
          imagedestroy ($sourceimg);
          }
          thumbnail ('pics/temp.jpg', 200);


          Comment

          • CountScubula

            #6
            Re: another imagejpeg question

            Sorry, I was able to soften it, but it was ahack so it didnt look so jittery



            <?php

            header("Content-type: image/jpeg");

            $img = "temp.jpg";

            $si = imagecreatefrom jpeg($img);

            $ow=485; $oh=335;
            $w=200; $h=138;

            $da = imagecreate($w, $h);
            $db = imagecreate($w, $h);

            imagecopyresize d($da,$si,0,0,0 ,0,$w,$h,$ow,$o h);
            imagecopyresize d($db,$si,0,0,0 ,0,$w,$h,$ow,$o h);
            imagecopymerge( $da,$db,1,1,0,0 ,$w,$h,15);
            imagejpeg($da," ",100);

            ?>

            --
            Mike Bradley
            http://www.gzentools.com -- free online php tools
            "Yang Li Ke" <yanglike@sympa tico.ca> wrote in message
            news:oZhXb.1238 3$lK.799110@new s20.bellglobal. com...[color=blue]
            > Hi Count :)
            >[color=green]
            > > I understand that copyresized is not a resample, but I haven't had many
            > > issues (actauly none) where quality is an issue, is it the resample or
            > > output quality that is buggin you?[/color]
            >
            > It's the output quality. the resamble is ok.
            >
            > See here is an example
            >
            > http://www.quebecwushu.com/test/test.php
            >
            > original image is here:
            >
            > http://www.quebecwushu.com/test/pics/temp.jpg
            >
            > I used this code:
            >
            > function thumbnail ($src, $maxv) {
            > $size = @getimagesize ($src);
            > if(($size[0] < $maxv)&&($size[1] < $maxv)){
            > $newx = $size[0];
            > $newy = $size[1];
            > }else{
            > if($size[0] > $size[1]){
            > $newx = intval ($maxv);
            > $newy = intval ($size[1] * ($maxv / $size[0]));
            > }else{
            > $newy = intval ($maxv);
            > $newx = intval ($size[0] * ($maxv / $size[1]));
            > }
            > }
            > $destimg = imagecreate ($newx, $newy );
            > $sourceimg = imagecreatefrom jpeg ($src);
            > imagecopyresize d ($destimg, $sourceimg, 0,0,0,0, $newx, $newy, $size[0],
            > $size[1]);
            > header ("content-type: image/jpeg");
            > imagejpeg ($destimg,"",10 0);
            > imagedestroy ($destimg);
            > imagedestroy ($sourceimg);
            > }
            > thumbnail ('pics/temp.jpg', 200);
            >
            >[/color]


            Comment

            • R. Rajesh Jeba Anbiah

              #7
              Re: another imagejpeg question

              "Yang Li Ke" <yanglike@sympa tico.ca> wrote in message news:<2lgXb.212 33$y07.680282@n ews20.bellgloba l.com>...[color=blue]
              > Hi CountScubula,
              >
              > Thank you very much for always helping me out with my problems.
              > I tried that imagcopyresized already before I even tried those other
              > sample codes from php.net but the quality generated from a imagecopyresize d
              > is really ugly. So this is why im trying to find somethingelse.
              >
              > Do you have any ideas?[/color]

              Why not try his <http://www-3.gzentools.com/gzimg.php>

              --
              "Success = 10% sweat + 90% tears"
              If you live in USA, please support John Edwards.
              Email: rrjanbiah-at-Y!com

              Comment

              • Andy Hassall

                #8
                Re: another imagejpeg question

                On Fri, 13 Feb 2004 22:10:44 -0500, "Yang Li Ke" <yanglike@sympa tico.ca> wrote:
                [color=blue]
                >Thank you very much for always helping me out with my problems.
                >I tried that imagcopyresized already before I even tried those other
                >sample codes from php.net but the quality generated from a imagecopyresize d
                >is really ugly. So this is why im trying to find somethingelse.[/color]

                Haven't seen it mentioned yet, so how about the already built in:



                Also you probably want to be using imagecreatetrue color() rather than
                imagecreate() if you're working with JPEGs.

                (All this needs a recent version of GD, e.g. the one bundled with the last few
                versions of PHP)

                --
                Andy Hassall <andy@andyh.co. uk> / Space: disk usage analysis tool
                <http://www.andyh.co.uk > / <http://www.andyhsoftwa re.co.uk/space>

                Comment

                • Yang Li Ke

                  #9
                  Re: another imagejpeg question

                  I know about this function too and it rocks!
                  but I am worrying if I create a script and distribute it
                  then people without gd2 will not be able to use this.



                  --


                  "Andy Hassall" <andy@andyh.co. uk> wrote in message
                  news:5cds20te62 j0n8qvrdl7s7rfg ral8272dk@4ax.c om...[color=blue]
                  > On Fri, 13 Feb 2004 22:10:44 -0500, "Yang Li Ke" <yanglike@sympa tico.ca>[/color]
                  wrote:[color=blue]
                  >[color=green]
                  > >Thank you very much for always helping me out with my problems.
                  > >I tried that imagcopyresized already before I even tried those other
                  > >sample codes from php.net but the quality generated from a[/color][/color]
                  imagecopyresize d[color=blue][color=green]
                  > >is really ugly. So this is why im trying to find somethingelse.[/color]
                  >
                  > Haven't seen it mentioned yet, so how about the already built in:
                  >
                  > http://uk2.php.net/manual/en/functio...yresampled.php
                  >
                  > Also you probably want to be using imagecreatetrue color() rather than
                  > imagecreate() if you're working with JPEGs.
                  >
                  > (All this needs a recent version of GD, e.g. the one bundled with the[/color]
                  last few[color=blue]
                  > versions of PHP)
                  >
                  > --
                  > Andy Hassall <andy@andyh.co. uk> / Space: disk usage analysis tool
                  > <http://www.andyh.co.uk > / <http://www.andyhsoftwa re.co.uk/space>[/color]


                  Comment

                  • Yang Li Ke

                    #10
                    Re: another imagejpeg question

                    Hi Count,

                    How can the imagecopymerge help for a better quality?

                    Thank you :)

                    Yang

                    "CountScubu la" <me@scantek.hot mail.com> wrote in message
                    news:SviXb.2504 8$o%4.21846@new ssvr25.news.pro digy.com...[color=blue]
                    > Sorry, I was able to soften it, but it was ahack so it didnt look so[/color]
                    jittery[color=blue]
                    >
                    > http://www.gzentools.com/test/resamp.php
                    >
                    > <?php
                    >
                    > header("Content-type: image/jpeg");
                    >
                    > $img = "temp.jpg";
                    >
                    > $si = imagecreatefrom jpeg($img);
                    >
                    > $ow=485; $oh=335;
                    > $w=200; $h=138;
                    >
                    > $da = imagecreate($w, $h);
                    > $db = imagecreate($w, $h);
                    >
                    > imagecopyresize d($da,$si,0,0,0 ,0,$w,$h,$ow,$o h);
                    > imagecopyresize d($db,$si,0,0,0 ,0,$w,$h,$ow,$o h);
                    > imagecopymerge( $da,$db,1,1,0,0 ,$w,$h,15);
                    > imagejpeg($da," ",100);
                    >
                    > ?>
                    >
                    > --
                    > Mike Bradley
                    > http://www.gzentools.com -- free online php tools
                    > "Yang Li Ke" <yanglike@sympa tico.ca> wrote in message
                    > news:oZhXb.1238 3$lK.799110@new s20.bellglobal. com...[color=green]
                    > > Hi Count :)
                    > >[color=darkred]
                    > > > I understand that copyresized is not a resample, but I haven't had[/color][/color][/color]
                    many[color=blue][color=green][color=darkred]
                    > > > issues (actauly none) where quality is an issue, is it the resample or
                    > > > output quality that is buggin you?[/color]
                    > >
                    > > It's the output quality. the resamble is ok.
                    > >
                    > > See here is an example
                    > >
                    > > http://www.quebecwushu.com/test/test.php
                    > >
                    > > original image is here:
                    > >
                    > > http://www.quebecwushu.com/test/pics/temp.jpg
                    > >
                    > > I used this code:
                    > >
                    > > function thumbnail ($src, $maxv) {
                    > > $size = @getimagesize ($src);
                    > > if(($size[0] < $maxv)&&($size[1] < $maxv)){
                    > > $newx = $size[0];
                    > > $newy = $size[1];
                    > > }else{
                    > > if($size[0] > $size[1]){
                    > > $newx = intval ($maxv);
                    > > $newy = intval ($size[1] * ($maxv / $size[0]));
                    > > }else{
                    > > $newy = intval ($maxv);
                    > > $newx = intval ($size[0] * ($maxv / $size[1]));
                    > > }
                    > > }
                    > > $destimg = imagecreate ($newx, $newy );
                    > > $sourceimg = imagecreatefrom jpeg ($src);
                    > > imagecopyresize d ($destimg, $sourceimg, 0,0,0,0, $newx, $newy,[/color][/color]
                    $size[0],[color=blue][color=green]
                    > > $size[1]);
                    > > header ("content-type: image/jpeg");
                    > > imagejpeg ($destimg,"",10 0);
                    > > imagedestroy ($destimg);
                    > > imagedestroy ($sourceimg);
                    > > }
                    > > thumbnail ('pics/temp.jpg', 200);
                    > >
                    > >[/color]
                    >
                    >[/color]


                    Comment

                    • CountScubula

                      #11
                      Re: another imagejpeg question

                      It actualy doesnt, It was a terible hack gone wrong :)

                      I tried to copy the image over the top of itself, shifted 1 pixel each
                      direction, and a bit translucent, trying to soften the jerky lines.



                      --
                      Mike Bradley
                      http://www.gzentools.com -- free online php tools
                      "Yang Li Ke" <yanglike@sympa tico.ca> wrote in message
                      news:fHvXb.1302 9$lK.871011@new s20.bellglobal. com...[color=blue]
                      > Hi Count,
                      >
                      > How can the imagecopymerge help for a better quality?
                      >
                      > Thank you :)
                      >
                      > Yang
                      >
                      > "CountScubu la" <me@scantek.hot mail.com> wrote in message
                      > news:SviXb.2504 8$o%4.21846@new ssvr25.news.pro digy.com...[color=green]
                      > > Sorry, I was able to soften it, but it was ahack so it didnt look so[/color]
                      > jittery[color=green]
                      > >
                      > > http://www.gzentools.com/test/resamp.php
                      > >
                      > > <?php
                      > >
                      > > header("Content-type: image/jpeg");
                      > >
                      > > $img = "temp.jpg";
                      > >
                      > > $si = imagecreatefrom jpeg($img);
                      > >
                      > > $ow=485; $oh=335;
                      > > $w=200; $h=138;
                      > >
                      > > $da = imagecreate($w, $h);
                      > > $db = imagecreate($w, $h);
                      > >
                      > > imagecopyresize d($da,$si,0,0,0 ,0,$w,$h,$ow,$o h);
                      > > imagecopyresize d($db,$si,0,0,0 ,0,$w,$h,$ow,$o h);
                      > > imagecopymerge( $da,$db,1,1,0,0 ,$w,$h,15);
                      > > imagejpeg($da," ",100);
                      > >
                      > > ?>
                      > >
                      > > --
                      > > Mike Bradley
                      > > http://www.gzentools.com -- free online php tools
                      > > "Yang Li Ke" <yanglike@sympa tico.ca> wrote in message
                      > > news:oZhXb.1238 3$lK.799110@new s20.bellglobal. com...[color=darkred]
                      > > > Hi Count :)
                      > > >
                      > > > > I understand that copyresized is not a resample, but I haven't had[/color][/color]
                      > many[color=green][color=darkred]
                      > > > > issues (actauly none) where quality is an issue, is it the resample[/color][/color][/color]
                      or[color=blue][color=green][color=darkred]
                      > > > > output quality that is buggin you?
                      > > >
                      > > > It's the output quality. the resamble is ok.
                      > > >
                      > > > See here is an example
                      > > >
                      > > > http://www.quebecwushu.com/test/test.php
                      > > >
                      > > > original image is here:
                      > > >
                      > > > http://www.quebecwushu.com/test/pics/temp.jpg
                      > > >
                      > > > I used this code:
                      > > >
                      > > > function thumbnail ($src, $maxv) {
                      > > > $size = @getimagesize ($src);
                      > > > if(($size[0] < $maxv)&&($size[1] < $maxv)){
                      > > > $newx = $size[0];
                      > > > $newy = $size[1];
                      > > > }else{
                      > > > if($size[0] > $size[1]){
                      > > > $newx = intval ($maxv);
                      > > > $newy = intval ($size[1] * ($maxv / $size[0]));
                      > > > }else{
                      > > > $newy = intval ($maxv);
                      > > > $newx = intval ($size[0] * ($maxv / $size[1]));
                      > > > }
                      > > > }
                      > > > $destimg = imagecreate ($newx, $newy );
                      > > > $sourceimg = imagecreatefrom jpeg ($src);
                      > > > imagecopyresize d ($destimg, $sourceimg, 0,0,0,0, $newx, $newy,[/color][/color]
                      > $size[0],[color=green][color=darkred]
                      > > > $size[1]);
                      > > > header ("content-type: image/jpeg");
                      > > > imagejpeg ($destimg,"",10 0);
                      > > > imagedestroy ($destimg);
                      > > > imagedestroy ($sourceimg);
                      > > > }
                      > > > thumbnail ('pics/temp.jpg', 200);
                      > > >
                      > > >[/color]
                      > >
                      > >[/color]
                      >
                      >[/color]


                      Comment

                      • CountScubula

                        #12
                        Re: another imagejpeg question

                        take a look at my gzImage script, you will see how I use resampled first,
                        and if not exist, I used resized.


                        --
                        Mike Bradley
                        http://www.gzentools.com -- free online php tools
                        "Yang Li Ke" <yanglike@sympa tico.ca> wrote in message
                        news:UerXb.1250 1$lK.835300@new s20.bellglobal. com...[color=blue]
                        > I know about this function too and it rocks!
                        > but I am worrying if I create a script and distribute it
                        > then people without gd2 will not be able to use this.
                        >
                        >
                        >
                        > --
                        >
                        >
                        > "Andy Hassall" <andy@andyh.co. uk> wrote in message
                        > news:5cds20te62 j0n8qvrdl7s7rfg ral8272dk@4ax.c om...[color=green]
                        > > On Fri, 13 Feb 2004 22:10:44 -0500, "Yang Li Ke" <yanglike@sympa tico.ca>[/color]
                        > wrote:[color=green]
                        > >[color=darkred]
                        > > >Thank you very much for always helping me out with my problems.
                        > > >I tried that imagcopyresized already before I even tried those other
                        > > >sample codes from php.net but the quality generated from a[/color][/color]
                        > imagecopyresize d[color=green][color=darkred]
                        > > >is really ugly. So this is why im trying to find somethingelse.[/color]
                        > >
                        > > Haven't seen it mentioned yet, so how about the already built in:
                        > >
                        > > http://uk2.php.net/manual/en/functio...yresampled.php
                        > >
                        > > Also you probably want to be using imagecreatetrue color() rather than
                        > > imagecreate() if you're working with JPEGs.
                        > >
                        > > (All this needs a recent version of GD, e.g. the one bundled with the[/color]
                        > last few[color=green]
                        > > versions of PHP)
                        > >
                        > > --
                        > > Andy Hassall <andy@andyh.co. uk> / Space: disk usage analysis tool
                        > > <http://www.andyh.co.uk > / <http://www.andyhsoftwa re.co.uk/space>[/color]
                        >
                        >[/color]


                        Comment

                        • Yang Li Ke

                          #13
                          Re: another imagejpeg question

                          Gotcha :)

                          Your the best !!!

                          --


                          "CountScubu la" <me@scantek.hot mail.com> wrote in message
                          news:Y8wXb.2545 2$xR2.22850@new ssvr25.news.pro digy.com...[color=blue]
                          > take a look at my gzImage script, you will see how I use resampled first,
                          > and if not exist, I used resized.
                          >
                          >
                          > --
                          > Mike Bradley
                          > http://www.gzentools.com -- free online php tools
                          > "Yang Li Ke" <yanglike@sympa tico.ca> wrote in message
                          > news:UerXb.1250 1$lK.835300@new s20.bellglobal. com...[color=green]
                          > > I know about this function too and it rocks!
                          > > but I am worrying if I create a script and distribute it
                          > > then people without gd2 will not be able to use this.
                          > >
                          > >
                          > >
                          > > --
                          > >
                          > >
                          > > "Andy Hassall" <andy@andyh.co. uk> wrote in message
                          > > news:5cds20te62 j0n8qvrdl7s7rfg ral8272dk@4ax.c om...[color=darkred]
                          > > > On Fri, 13 Feb 2004 22:10:44 -0500, "Yang Li Ke"[/color][/color][/color]
                          <yanglike@sympa tico.ca>[color=blue][color=green]
                          > > wrote:[color=darkred]
                          > > >
                          > > > >Thank you very much for always helping me out with my problems.
                          > > > >I tried that imagcopyresized already before I even tried those other
                          > > > >sample codes from php.net but the quality generated from a[/color]
                          > > imagecopyresize d[color=darkred]
                          > > > >is really ugly. So this is why im trying to find somethingelse.
                          > > >
                          > > > Haven't seen it mentioned yet, so how about the already built in:
                          > > >
                          > > > http://uk2.php.net/manual/en/functio...yresampled.php
                          > > >
                          > > > Also you probably want to be using imagecreatetrue color() rather than
                          > > > imagecreate() if you're working with JPEGs.
                          > > >
                          > > > (All this needs a recent version of GD, e.g. the one bundled with the[/color]
                          > > last few[color=darkred]
                          > > > versions of PHP)
                          > > >
                          > > > --
                          > > > Andy Hassall <andy@andyh.co. uk> / Space: disk usage analysis tool
                          > > > <http://www.andyh.co.uk > / <http://www.andyhsoftwa re.co.uk/space>[/color]
                          > >
                          > >[/color]
                          >
                          >[/color]


                          Comment

                          • Larry Jaques

                            #14
                            Re: another imagejpeg question

                            On Sat, 14 Feb 2004 04:08:00 GMT, "CountScubu la"
                            <me@scantek.hot mail.com> brought forth from the murky depths:
                            [color=blue]
                            >I am using copyresized on this site: http://www.hairreview.com (my pet
                            >project), well I am using my gzImage functions.[/color]

                            I use AdSubtract and with it engaged, the individual pages
                            don't show the correct graphics (except the header pic and
                            nav bar).

                            I selected women's short and the page came up with 18 blank
                            spaces in the table. I clicked on the first one and the
                            picture shown was a pixelated "Hair Review" squeeze. Strange.
                            It works fine if I turn AdSubtract off and refresh the page.

                            Did they provide the various-sized graphics and you're just
                            resizing them to fit the table? Some have their perspective
                            squeezed out of proportion a bit, as if a 100x100px pic was
                            put in the 78x100 box. s12.jpg and s14.jpg are examples.

                            [color=blue]
                            >there is a copyresampled function, I do not know if it is compiled in for
                            >you, but give it a shot.[/color]

                            That's the one I'd opt for.


                            And I can see why that's your pet site. What a long strange
                            trip it's been...o132.jpg is a formal 'do'? <g>


                            --
                            Impeach 'em ALL!
                            ----------------------------------------------------
                            http://diversify.com Website Application Programming

                            Comment

                            • CountScubula

                              #15
                              Re: another imagejpeg question

                              Ok several things,

                              firts, thank you, wow o132.jpg is not a formal hair do. there are over 5,000
                              images that need to be set up, and I am only about 3,500 into it. I am
                              viewing the source files and adding them to the site every day. (only 500 or
                              so, I do have other things I like to do :) When I have them all on the
                              site, I am going to hire a couple employees to manage it (I will be turning
                              this into a real print magazine soon) Ther will be move this pic to catagory
                              boxes for logged in admins.


                              I am checking the referer to stop image steeling. I am going to be changing
                              it to a cookie based in the next couple days. I found someone useing
                              automated software to spider and suck the site.

                              only the hair review image gets resized to fit the output size, other than
                              that all images are using the gzImage functions with cache files as well.

                              I am using a new function in gzImage called Crop, to try an elimate the
                              sqeeze effect, please let me know if you notice something wrong with that
                              function (I swear complex stuff no problem, but I stumble everywhere on
                              simple stuff)





                              --
                              Mike Bradley
                              http://www.gzentools.com -- free online php tools
                              "Larry Jaques" <novalidaddress @di\/ersify.com> wrote in message
                              news:qv6v20h3q0 e1242m7ces1318q ma5b7pe4v@4ax.c om...[color=blue]
                              > On Sat, 14 Feb 2004 04:08:00 GMT, "CountScubu la"
                              > <me@scantek.hot mail.com> brought forth from the murky depths:
                              >[color=green]
                              > >I am using copyresized on this site: http://www.hairreview.com (my pet
                              > >project), well I am using my gzImage functions.[/color]
                              >
                              > I use AdSubtract and with it engaged, the individual pages
                              > don't show the correct graphics (except the header pic and
                              > nav bar).
                              >
                              > I selected women's short and the page came up with 18 blank
                              > spaces in the table. I clicked on the first one and the
                              > picture shown was a pixelated "Hair Review" squeeze. Strange.
                              > It works fine if I turn AdSubtract off and refresh the page.
                              >
                              > Did they provide the various-sized graphics and you're just
                              > resizing them to fit the table? Some have their perspective
                              > squeezed out of proportion a bit, as if a 100x100px pic was
                              > put in the 78x100 box. s12.jpg and s14.jpg are examples.
                              >
                              >[color=green]
                              > >there is a copyresampled function, I do not know if it is compiled in for
                              > >you, but give it a shot.[/color]
                              >
                              > That's the one I'd opt for.
                              >
                              >
                              > And I can see why that's your pet site. What a long strange
                              > trip it's been...o132.jpg is a formal 'do'? <g>
                              >
                              >
                              > --
                              > Impeach 'em ALL!
                              > ----------------------------------------------------
                              > http://diversify.com Website Application Programming[/color]


                              Comment

                              Working...