On 5/15/06, Gustav Wiberg <[EMAIL PROTECTED]> wrote:
[snip]
//What should/could I do here?
//
//Set new width and height
//
$new_width = 100;
$new_height = 200;
$tmp_image=imagecreatefromjpeg($toPath . $mfileAdd);
$width = imagesx($tmp_image);
$height = imagesy($tmp_image);
$new_image = imagecreatetruecolor($new_width,$new_height);
ImageCopyResized($new_image, $tmp_image,0,0,0,0, $new_width,
$new_height, $width, $height);
I can't see anything wrong with this resizing.
//Grab new image
ob_start();
ImageJPEG($new_image);
$image_buffer = ob_get_contents();
ob_end_clean();
ImageDestroy($new_image);
//Create temporary file and write to it
$fp = tmpfile();
fwrite($fp, $image_buffer);
rewind($fp);
Instead of doing this, you may want to use the filename
argument of ImageJPEG to save the image directly to a file.
//Upload new image
$copyTo = 'http://www.ledins.se/test.jpg';
$conn_id = ftp_connect('<domain>');
ftp_login($conn_id,'<username for domain>','<password>');
ftp_fput($conn_id, $copyTo, $fp, FTP_BINARY);
Destination file ($copyTo) is supposed to be a path (eg.
public_html/test.jpg) and not a URL.
Rabin
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php