[an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] (none) [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive][an error occurred while processing this directive]
 
[an error occurred while processing this directive] [an error occurred while processing this directive]
Skåne Sjælland Linux User Group - http://www.sslug.dk Home   Subscribe   Mail Archive   Forum   Calendar   Search
MhonArc Date: [Date Prev] [Date Index] [Date Next]   Thread: [Date Prev] [Thread Index] [Date Next]   MhonArc
 

Skalering af billeder i PHP



Hej,

Hvordan kan man lige skalere et billede nemt i PHP?

Jeg vil gerne have, at hvis et billede er større end max 800pixels i bredden og/eller større end max 600 pixels i højden, så skal det skaleres, så det passer til max værdierne. Hvordan kan man det?

Jeg har prøvet med at sige:

$size = GetImageSize ("billede.jpg");
                                                                                                                                                   
if ( $size[0] > 800 ) {
  $width = 800;
}
if ( $size[1] > 600 ) {
  $height = 600;
}


Men det går jo ligesom kun i nogen tilfælde :-) Hvis billedet er et portrait-format, hvor begge værdier kommer udenfor grænserne, så går det galt.

Hvordan kan jeg lige rette op på det?

Anders


 
Home   Subscribe   Mail Archive   Index   Calendar   Search

 
 
Questions about the web-pages to <www_admin>. Last modified 2005-08-10, 22:43 CEST [an error occurred while processing this directive]
This page is maintained by [an error occurred while processing this directive]MHonArc [an error occurred while processing this directive] # [an error occurred while processing this directive] *