[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
 

Re: [PROGRAMMERING] Skalering af billeder i PHP



Anders Misfeldt wrote:
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 ville nok prøve med noget i denne stil:


$size = GetImageSize ("billede.jpg");

$scale = 1;

if ( $size[0] > 800 ) {
  $width = 800;
  $scale = 800/$size[0];
  $height = $size[1]*$scale;
}

if ( $scale*$size[1] > 600 ) {
  $height = 600;
  $scale = 600/$size[1];
  $width = $size[0]*$scale;
}

Med venlig hilsen

Ole

 
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] *