| @@ -149,14 +149,28 @@ function get_images($document_reference){ | |||
| $ch = curl_init(); | |||
| curl_setopt($ch, CURLOPT_URL, $drawings_url); | |||
| 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 | |||
| $response = curl_exec($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; | |||
| } | |||
| @@ -140,10 +140,13 @@ include '../ops_api.php' | |||
| 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 | |||
| endif; | |||
| @@ -127,10 +127,13 @@ $publication_details = get_publication_details($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 | |||
| endif; | |||
| @@ -31,10 +31,13 @@ $random_doc_refs = ten_random_doc_refs($core); | |||
| 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 | |||
| endforeach; | |||