Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

image compress with php code without image quality disturb

Posted on 2013-11-28
4
Medium Priority
?
2,854 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 84

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 111

Accepted Solution

by:
Ray Paseur earned 1500 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 111

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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this. Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it i…
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

972 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