|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2001-05-22 18:40 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 02:00:01 2025 UTC |
Look at the bugs for GetImageSize. I guess it's the same JPG problem with GD functions. This function works perfect with most jpg's but when uploading pictures from digital cameras it does nothing. <pre> function resize($bildet, $forholdstall) { $size = GetImageSize("$bildet"); $width = $size[0]; $height = $size[1]; echo "Skalerer..."; //regner ut forholdstall if ($width > $height) # resize ny bildest?rrelse { $utregnettall = ($width / $forholdstall); $width = $forholdstall; $height = (int)($height / $utregnettall); } else { $utregnettall = ($height / $forholdstall); $height = $forholdstall; $width = (int)($width / $utregnettall); } if (strpos("$bildet", ".jpg") || strpos("$bildet", ".jpeg")) { $status = true; $img_in = ImageCreateFromJPEG("$bildet"); // den resiza fila skal v?re s? mye mindre: $img_out = ImageCreate($width, $height); ImageCopyResized($img_out, $img_in,0,0,0,0, $width, $height, $size[0], $size[1]); ImageJPEG($img_out, "$bildet"); ImageDestroy($img_in); ImageDestroy($img_out); }#if else { $status = false; } $retur = array( "error" => $status, "height" => $height, "width" => $width ); return $retur; }# function resize </pre>