Search the Community
Showing results for tags 'gd library'.
-
Hi everyone, here is a thing that I need help with. Firstly I am not good in php programming - have some understanding of it. First: why? I am starting up a site that sells editorial content (images) to different newspapers, magazines and so on. The website will show the images and let the customer choose licens and size of image (large, medium, small) since there are big difference between prices, depending on the size of the image, I need the function to on-demand resize the image after customers choice. So far so good - the site I have works and if I fiddle around with pricegroup and size it does the job of resizing - but and this is a big but, when it resizes the image it also deletes all information in exif, metadata colorprofile and resolution. So the customer gets a image that he cannot print or use at all. The developer of the shoppingcart will not alter the file to solve this issue (atleast not yet) but I am free to do this myself as I see fit. So to clarify: I need to modify the code below to preserve all information (exif, colorprofile, copyright, metadata). Either by using wordpress GD library (it does use that now) or switch it for better usage with imagick. But the original file must be left unaltered so a new copy with the new size is created upon checkout and then made available for download after purchase. Code that does the resizing: public function create_download_size( $size, $location=null ){ $image_p = imagecreatetruecolor( $size['width'], $size['height'] ); $image = imagecreatefromjpeg( $location ); list( $current_image['width'], $current_image['height'] ) = getimagesize( $location ); imagecopyresampled($image_p, $image, 0, 0, 0, 0, $size['width'], $size['height'], $current_image['width'], $current_image['height']); $destination_file = $this->tmp_dir . basename( $location ); if ( ! file_exists( $destination_file ) ){ wp_mkdir_p( dirname( $destination_file ) ); } From what I have been told the function "imagecopyresampled" make a copy of the original and it is then all information is deleted. Can I extract the exif and then rewrite it back to the new resized copy of the image? or rewrite this code to use imagick instead, imagick should preserve exif (do not know but been told so) So do anyone want to give it a try and solve this? I have according to my webhost imagick installed at "exec('/usr/bin/convert') I hope that this is something that can be solved. Regards, mxfarsa..
-
- gd library
- exif
-
(and 3 more)
Tagged with: