You could always write your own. It's pretty straightforward and if
you come up with something special, you can share it in the bakery ;)
I usually create them on the fly as the requirement for each site can
be very different. But a fragment I use to resize a photo to fit a box
is:
function doUploadFitFrame($file, $maxwidth, $maxheight,
$new_fname=null)
{
// Upload & resize a photo to fit in a defined frame,
$maxwidth X $maxheight
//
if ($file['error']=="0")
{
// Get new dimensions
//
list($origwidth, $origheight,$type, $string) =
getimagesize($file['tmp_name']); //original dims
if (($maxheight*$origwidth)/$origheight > $maxwidth)
{
// Use $maxwidth.$height/$width
$shrink_factor = $maxwidth/$origwidth;
}
else
{
// Use maxheight.$width/$height
$shrink_factor = $maxheight/$origheight;
}
$new_width = intval($origwidth * $shrink_factor);
$new_height = intval($origheight *
$shrink_factor);
// Resample
//
$image_p = imagecreatetruecolor($new_width,
$new_height);
$white = imagecolorallocate($image_p, 255, 255,
255);
imagefill($image_p, 0, 0, $white);
$ext = $this->_picTypes[$file['type']];
switch($ext)
{
case "jpg" :
$image =
imagecreatefromjpeg($file['tmp_name']);
break;
case "gif" :
$image =
imagecreatefromgif($file['tmp_name']);
break;
case "png" :
$image =
imagecreatefrompng($file['tmp_name']);
break;
}
imagecopyresampled($image_p, $image, 0, 0, 0, 0,
$new_width, $new_height, $origwidth, $origheight);
etc....
On Jun 6, 1:15 pm, Smelly_Eddie <[EMAIL PROTECTED]> wrote:
> I have now tried several upload components and have been largely
> disappointed with all. I thought for sure there would be a "holy-wow
> this rocks" type component out there already.
>
> What upload component do you use to resize and manage photos
> associated with model items' i.e. Products?
>
> Thanks in advance for any replies.
>
> Eddie
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---