php - Print Pictures, why is it so difficult -


i have asked before believe i'm having more issues it. have got web application runs on local server. when user adds sales image, page generated sales.

this consists of images, amount of images changing depending on how many sales have been made. these images can vary between landscape , portrait. in order print images must rotated portrait, use php , imagick detect width , height , rotate them accordingly.

so, here example page 5 images ready printed.

<div class="print_container" id="print_container" style="display: block;">     <div data-type="kr">         <img onload="c++;count_loaded();" id="lkr_6_0" data-quantity="2" onclick="disable_print(this,'print_container')" src="http://localhost:1234/ppa/php/generateimage.php?imgname=c:/xampp/htdocs/ppa/data/images/20140324/0/039.jpg&amp;restraint=width" class="">         <img onload="c++;count_loaded();" id="lkr_6_1" data-quantity="2" onclick="disable_print(this,'print_container')" src="http://localhost:1234/ppa/php/generateimage.php?imgname=c:/xampp/htdocs/ppa/data/images/20140324/0/039.jpg&amp;restraint=width" class="">         <img onload="c++;count_loaded();" id="lkr_7_0" data-quantity="2" onclick="disable_print(this,'print_container')" src="http://localhost:1234/ppa/php/generateimage.php?imgname=c:/xampp/htdocs/ppa/data/images/20140324/0/040.jpg&amp;restraint=width" class="">         <img onload="c++;count_loaded();" id="lkr_7_1" data-quantity="2" onclick="disable_print(this,'print_container')" src="http://localhost:1234/ppa/php/generateimage.php?imgname=c:/xampp/htdocs/ppa/data/images/20140324/0/040.jpg&amp;restraint=width" class="">         <img onload="c++;count_loaded();" id="lkr_13_0" data-quantity="3" onclick="disable_print(this,'print_container')" src="http://localhost:1234/ppa/php/generateimage.php?imgname=c:/xampp/htdocs/ppa/data/images/20140324/2/039.jpg&amp;restraint=width" class="">     </div> </div> 

as can see link php file , image returned there. nice way detect if same image being rotate , instance duplicates instead of rotating multiple times, it's issue @ moment.

here code generates image:

<?php //need add code generate image if unable load try {     $im = new imagick();     $im->readimage($_get['imgname']);     $im->setimageformat("jpg");      $d = $im->getimagegeometry();     $w = $d['width'];     $h = $d['height'];      if (isset($_get['restraint'])) {         if($_get['restraint'] == "width") {             if ($w > $h) {                 $im->rotateimage(new imagickpixel(), 90);             }         } elseif ($_get['restraint'] == "height") {             if ($w < $h) {                 $im->rotateimage(new imagickpixel(), 90);             }         }         header("content-type: image/jpeg");         print $im->getimage();          $im->clear();          $im->destroy();      } } catch (exception $e) {     die('error when creating image: ' . $e->getmessage()); } ?> 

all above seems work fine, when can print images google chrome, print preview fails, don't mind disabling it's pointless. printing using system print dialog not work, doesn't print , gives no errors. i'm assuming issues linked...?

is possible send data print job? p.s print connected on wifi if makes difference?


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -