Solved

image compress with php code without image quality disturb

Posted on 2013-11-28
4
2,328 Views
Last Modified: 2013-12-17
Hello Expert,

We write program in php for upload photo and photo size may be small, big. In case of big image, server take more space so i want to upload photo with compress and compress image is very small size rather than original image or without disturb image quailty .

I would like to know that do you have any idea for compress image when upload photo via script in PHP.

Please help me.

Thanks
0
Comment
Question by:singhpreeti
  • 2
4 Comments
 
LVL 83

Expert Comment

by:Dave Baldwin
ID: 39684735
Compressing and/or reducing images always loses quality because compression is done thru a mathematical operation that discards information to reduce the file size.
0
 
LVL 110

Accepted Solution

by:
Ray Paseur earned 500 total points
ID: 39685553
very small size rather than original image or without disturb image quailty
Can't be done.  And any image that is made smaller suffers a loss of image information.  You can't enlarge them again with the same original fidelity.

You have three methods of storing images.  GIF compression is useful if the images are graphics (not photos) and the color precision is unimportant.  PNG compression and JPEG compression are useful if the images are photographs.  PNG compression is lossless, meaning that all of the original image information is retained, and as a result, it allows very little compression.  JPG compression is lossy, in that it discards image information but in a way that causes the compressed image to be a visually satisfactory representation of the original image.

These three articles may be useful to you.  Please read them over and post back with any questions.  They cover the essentials and they have code examples.
http://www.experts-exchange.com/Software/Photos_Graphics/Images_and_Photos/A_5931-Putting-Your-Photos-Online.html
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_6554-Use-PHP-to-Make-an-Image-Thumbnail.html
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_10065-Adding-a-Watermark-to-an-Image.html

One final note... Consider the value of your images compared to the cost of computer storage.  Computer storage is very, very cheap today.  But replacing a lost or degraded image may be very expensive.  Imagine the cost of restaging a wedding!  You might want to consider keeping all versions of the image files.
0
 
LVL 20

Expert Comment

by:Mark Brady
ID: 39691421
What you should do is upload the original image but also create a smaller image to display on your webpage so it loads faster. You can do this with php and you make a link on your smaller thumbnail image to the original large image. There are lots of examples of how to do this if you search google.
0
 
LVL 110

Expert Comment

by:Ray Paseur
ID: 39723649
@singhpreet: I see you are new to Experts-Exchange.  When you give a marked down grade, you're expected to provide an explanation of the deficiency in the answer.
A should be the default grade awarded unless the answer is deficient.
When closing the question, the asker should explain why a B grade was awarded.
If you read the three articles linked here, you would have found exactly what you're looking for, so I would like to hear your explanation of the bad grade.
http://support.experts-exchange.com/customer/portal/articles/481419
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
This article discusses four methods for overlaying images in a container on a web page
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

697 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question