Solved

image compress with php code without image quality disturb

Posted on 2013-11-28
4
2,239 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 109

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 109

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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
How is this connection happening? 3 20
What does this formatting equate to? 7 18
Wordpress Query 5 25
Why is PHP Storm giving me an undefined constant error? 4 19
Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
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…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

839 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