Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Miniaturki PHP
northwest
post
Post #1





Grupa: Zarejestrowani
Postów: 788
Pomógł: 1
Dołączył: 17.09.2004

Ostrzeżenie: (10%)
X----


Witam serdecznie,
Potrzebuję zrobić generator miniaturek w PHP. chciałbym skryptem nakładać zrobioną już miniaturkę na pusty kwadrat i łączysz w jeden obrazek. (chce uzyskać w galerii jednakową wielkość miniaturek)

Wie ktoś może jak to ugryźć?

Łukasz
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
northwest
post
Post #2





Grupa: Zarejestrowani
Postów: 788
Pomógł: 1
Dołączył: 17.09.2004

Ostrzeżenie: (10%)
X----


super dzięki (IMG:style_emoticons/default/smile.gif)

ps. znalazłem jeszcze taką funkcję:
Kod
function generateThumbnail($fname, $thwidth, $thheight, $fnname)     
   {

      $src = imagecreatefromjpeg($fname);
      list($imgwidth,$imgheight)=getimagesize($fname);
      $imgratio = $imgwidth / $imgheight;
      $thratio = $thwidth / $thheight;
      
    
      if ($imgratio < $thratio)
      {
         $newwidth = $thheight * $imgratio;
         $offsetx = ($thwidth - $newwidth) / 2;
         $newheight = $thheight;
         $offsety = 0;
      }
      else
      {
         $newwidth = $thwidth;
         $offsetx = 0;
         $newheight = $thwidth / $imgratio;    
         $offsety = ($thheight - $newheight) / 2;
      }
      
      $tmp=imagecreatetruecolor($thwidth,$thheight);
      
      imagecopyresampled($tmp,$src,$offsetx,$offsety,0,0,$newwidth,$newheight,$imgwidth,$imgheight);
      
      $p = strpos($_SERVER['REQUEST_URI'], 'index.php');

      $subpath = '/hmip/_thumb/';
      $tmpfilename = $_SERVER['DOCUMENT_ROOT'].$subpath.$fnname;
      
      imagejpeg($tmp,$tmpfilename,100);
      imagedestroy($src);
      imagedestroy($tmp);
      
      return $tmpfilename;
      
   }


ten kod też nadaje marginesy :-) tylko są czarne... da się je ustawić jakoś na białe?
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 8.10.2025 - 22:55