Announcement

Collapse
No announcement yet.

Poor Image Quality

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    your brain supports clipboard functions?

    pure genius.

    also,

    dynimage.php
    Code:
    <?php
    function imageScale($image, $newWidth, $newHeight)
    {
    	if(!$size = @getimagesize($image))
    		die("Unable to get info on image $image");
    	
    	$ratio = ($size[0] / $size[1]);
    	
    	//scale by height
    	if($newWidth == -1)
    	{
    		$ret[1] = $newHeight;
    		$ret[0] = round(($newHeight * $ratio));
    	}
    	else if($newHeight == -1)
    	{
    		$ret[0] = $newWidth;
    		$ret[1] = round(($newWidth / $ratio));
    	}
    	else
    		die("Scale Error");
    	
    	return $ret;
    }
    // The file
    $filename = $_GET['filename'];
    
    if(isset($_GET['height'])) {$newheight = $_GET['height'];} else {$newheight = 32;}
    if(isset($_GET['quality'])) {$quality = $_GET['quality'];} else {$quality = 65;}
    
    // Content type
    header('Content-type: image/jpeg');
    header("Last-Modified: " . gmdate("D, d M Y H:i:s",mktime (0,0,0,1,1,2000)) . " GMT");  // Date in the past
    header("Expires: Mon, 26 Jul 2040 05:00:00 GMT");    // In other words... never expire the image
    header("Cache-Control: max-age=10000000, s-maxage=1000000, proxy-revalidate, must-revalidate");//Cache-Control header is 
    /**/
    // Get new dimensions
    list($width, $height) = getimagesize($filename);
    $scale = imageScale($filename, -1, $newheight);
    
    // Resample
    $image_p = imagecreatetruecolor($scale[0], $scale[1]);
    $image = imagecreatefromjpeg($filename);
    imagecopyresampled($image_p, $image, 0, 0, 0, 0, $scale[0], $scale[1], $width, $height);
    
    // Output
    imagejpeg($image_p, null, $quality);
    ?>
    is code to use php to resize images at the server level.

    use it like this:
    <img src="dynimage.php?filename=imagename.jpg&height=75&quality=50">

    to resize the image called imagename.jpg to 75 pixels hight (to its correct ratio width) at 50% quality.

    this code generates thumbnails and popups on this pages 'dealfinder'.
    http://www.skateasylum.co.uk/acatalo...d-skates-.html

    Comment


      #17
      Nicola on a serious note before they get carried away

      If you are not the person that did the photo's then this bit of software might help http://bluefive.pair.com/pixresizer.htm

      Darren

      Comment


        #18
        Nicola on a serious note before they get carried away
        you bloody cheeky sod.

        i was trying to help.

        Comment


          #19
          Originally posted by gabrielcrowe
          <img src="dynimage.php?filename=imagename.jpg&height=75&quality=50">
          Nice one Gabe .... may be worth expanding on the above and where to implement in v7's nested template structure.


          Bikster
          SellerDeck Designs and Responsive Themes

          Comment


            #20
            Originally posted by gabrielcrowe
            is code to use php to resize images at the server level.

            use it like this:
            <img src="dynimage.php?filename=imagename.jpg&height=75&quality=50">

            to resize the image called imagename.jpg to 75 pixels hight (to its correct ratio width) at 50% quality.

            this code generates thumbnails and popups on this pages 'dealfinder'.
            http://www.skateasylum.co.uk/acatalo...d-skates-.html
            smart arse, i take your feeling a whole load better this week then gabriel

            Nicola and yer sorry forgot to say you could use a bit of PHP - oh gabriel beat me to it, i was just about to show you

            Comment


              #21
              well, i think i covered all the bases: ratio/quality/filename.

              Comment


                #22
                Originally posted by jont
                or you can get very tricky and use PHP to resample

                Darren.. are you skip reading the posts again?


                Bikster
                SellerDeck Designs and Responsive Themes

                Comment


                  #23
                  Originally posted by jont
                  Darren.. are you skip reading the posts again?
                  The only way i can keep up on a friday afternoon

                  Comment


                    #24
                    oops, sorry about that outburst mr darren, i was all a fluster dealing with some misbehaving css.

                    Comment


                      #25
                      Originally posted by gabrielcrowe
                      oops, sorry about that outburst mr darren, i was all a fluster dealing with some misbehaving css.
                      Gabs, i never take offence, i am a mild mannered person who does not get upset and keeps his testerone incheck, not like some frustrated members of the community

                      Comment


                        #26
                        hope you're not easily offended nicola. tis only in jest after all.
                        Attached Files

                        Comment


                          #27
                          Originally posted by gabrielcrowe
                          hope you're not easily offended nicola. tis only in jest after all.
                          That Lee dont hang around

                          Comment


                            #28
                            Originally posted by gabrielcrowe
                            hope you're not easily offended nicola. tis only in jest after all.
                            Thought he had gone quiet....
                            Affordable solutions for busy professionals.
                            Website Maintenance | UK Web Hosting

                            Comment


                              #29
                              omg, I just got back in and thought I'd catch up!
                              What *ARE* you lot on today?!
                              Tracey

                              Comment


                                #30
                                Originally posted by jont
                                Will you stop it
                                Tracey - don't label me with these hooligans


                                Bikster
                                SellerDeck Designs and Responsive Themes

                                Comment

                                Working...
                                X