Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

image compress with php code without image quality disturb

Posted on 2013-11-28
4
Medium Priority
?
2,685 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
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.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

722 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