| $ch = curl_init(); | $ch = curl_init(); | ||||
| curl_setopt($ch, CURLOPT_URL, $drawings_url); | curl_setopt($ch, CURLOPT_URL, $drawings_url); | ||||
| curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); | ||||
| curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: Bearer $access_token","Accept: application/pdf")); | |||||
| curl_setopt($ch, CURLOPT_HTTPHEADER, array("Authorization: Bearer $access_token","Accept: application/tiff")); | |||||
| // Give back curl result | // Give back curl result | ||||
| $response = curl_exec($ch); | $response = curl_exec($ch); | ||||
| curl_close($ch); | curl_close($ch); | ||||
| // Return the PDF response | |||||
| return $response; | |||||
| // Create Imagick object | |||||
| $image = new Imagick(); | |||||
| // Convert image into Imagick | |||||
| $image->readimageblob($response); | |||||
| // Convert image to png | |||||
| $image->setImageFormat("png"); | |||||
| // Add a subtle border | |||||
| $color=new ImagickPixel(); | |||||
| $color->setColor("rgb(220,220,220)"); | |||||
| $image->borderImage($color,1,1); | |||||
| // Return the Imagick object | |||||
| return $image; | |||||
| } | } | ||||
| if (check_for_images($result['doc_ref'])): | if (check_for_images($result['doc_ref'])): | ||||
| ?> | ?> | ||||
| <iframe src="./ops_image.php?doc_ref=<?php echo $result['doc_ref'] ?>#view=fitH" height="780px" width="100%"> | |||||
| </iframe> | |||||
| <?php | |||||
| $image = get_images($result["doc_ref"]); | |||||
| ?> | |||||
| <br><br> | |||||
| <?php | |||||
| echo '<img class="img-fluid" src="data:image/jpg;base64,'.base64_encode($image->getImageBlob()).'" alt="Drawing of patent" />'; | |||||
| ?> | |||||
| <?php | <?php | ||||
| endif; | endif; |
| if (check_for_images($random_record['doc_ref'])): | if (check_for_images($random_record['doc_ref'])): | ||||
| ?> | ?> | ||||
| <iframe src="./ops_image.php?doc_ref=<?php echo $random_record['doc_ref'] ?>#view=fitH" height="780px" width="100%"> | |||||
| </iframe> | |||||
| <?php | |||||
| $image = get_images($random_record["doc_ref"]); | |||||
| ?> | |||||
| <br><br> | |||||
| <?php | |||||
| echo '<img class="img-fluid" src="data:image/jpg;base64,'.base64_encode($image->getImageBlob()).'" alt="Drawing of patent" />'; | |||||
| ?> | |||||
| <?php | <?php | ||||
| endif; | endif; |
| foreach($random_doc_refs as $doc_ref): | foreach($random_doc_refs as $doc_ref): | ||||
| ?> | ?> | ||||
| <iframe src="./ops_image.php?doc_ref=<?php echo $doc_ref ?>" width="100%" height="500px"> | |||||
| </iframe> | |||||
| <?php | |||||
| $image = get_images($doc_ref); | |||||
| ?> | |||||
| <br><br> | |||||
| <?php | |||||
| echo '<img class="img-fluid" src="data:image/jpg;base64,'.base64_encode($image->getImageBlob()).'" alt="Drawing of patent" />'; | |||||
| ?> | |||||
| <?php | <?php | ||||
| endforeach; | endforeach; |