Hi All
I've got an idea for a project that involves a user uploading a high res image to my server so we can artwork the files.
Could someone give me some advise on what is the best way to upload a large image max (5mb) . For example I would I stop the server from timing out during the upload and is there a way to create a thumbnail using the GD library etc
Cheers
Rich
JPEG Image Upload
Moderator: General Moderators
-
kettle_drum
- DevNet Resident
- Posts: 1150
- Joined: Sun Jul 20, 2003 9:25 pm
- Location: West Yorkshire, England
-
hurdy gurdy
- Forum Commoner
- Posts: 40
- Joined: Mon Jun 09, 2003 8:19 pm
Re: JPEG Image Upload
I believe the default value for PHP's upload max file size is 2 megs. You might have to change that, if you havent already.
To create a thumbnail from the uploaded JPEG try this:
Code: Select all
<?php
$src = ImageCreateFromJPEG ($src_filename);
$width = ImageSx ($src);
$height = ImageSy ($src);
$x = $desired_width;
$y = $desired_height;
$dst = ImageCreateTrueColor ($x, $y);
ImageCopyResampled ($dst, $src, 0, 0, 0, 0, $x, $y, $width, $height);
ImageJPEG ($dst, $dst_filename); // or ImagePNG or whatever
DestroyImage ($dst);
?>