can i optmize image to 50% quality before uploading 2 server


Posted on 16th Feb 2014 07:03 pm by admin

Hi there

i have jus written a php program to upload and display images but when i try to upload them it takes a long time to upload if the file is big. But the big problem is when i try to display them. The time taken to display them is huge. so i was just wondering if its posible to optimize a image quality to 50% or reduce size before uploading it to the server and also save some bandwidth. can i do this directly from the upload form for jpeg image

$name=$_FILES['file']['name'];
$tmpname=$_FILES['file']['tmp_name'];
$path=images/$name;
$tmp=imagecreatefromjpeg($tmpname);
imagejpeg($tmp,$path,50);

Any comments would be grately be appreciated

No comments posted yet

Your Answer:

Login to answer
282 Like 26 Dislike
Previous forums Next forums
Other forums

Question about ShowWindow()
Hello....

I'm struggling with sumpin, and I hope y'all can help.

I've got a CFormView

How would I protect......
I have a from, actually, a good amount of forms. How can I make it so you can't type the characters:

Keep newlines from textarea?..
I'm creating a simple encoding program, and what I want it to do is retain the newlines, as echoing

mr8m - reverse document
Friends,

I'm trying to reverse a document held by MIRO, but it reports the message balan

Need help with an email blocker for a guessbook
I am new with php and here is a simple guessbook page but I am being hit with spam from a group of t

Securing a user input - need some confirmation
Hello All,

I am in the process of recoding a large proportion of an e-commerce site, one of t

Force download script not handling files with spaces properly
I have a regular old php force download script, uses this code:

Code: header("Cache-Cont

Displaying image from database
Hi,

I've got a site where that's got a database behind it. Currently it has loads of items in

PHP Code reffering to database, doing something wrong.. pls help
Well i am quite new with PHP
and for school we have to make a PHP script which reffers to a Data

Chat Box in PHP
I was thinking in doing a Chat Box in PHP. For that I would use a form with two fields, Nick and Mes

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash