Gives you attachment body as return value

@param int   $attachmentID
@param array $options      Additional Connection Options

@return string
19208
public static function getAttachment($attachmentID,$options = [])
    {
        $result     = null;
        $downloader = new Priloha($attachmentID,$options);
        if ($downloader->lastResponseCode == 200) {

            $downloader->doCurlRequest(self::getDownloadURL($downloader), 'GET');
            if ($downloader->lastResponseCode == 200) {
                $result = $downloader->lastCurlResponse;
            }
        }
        return $result;
    }
685116
public function mDeleteDocument($documentIds, array $options = [])
    {
        if (!is_array($documentIds)) {
            throw new InvalidArgumentException('Collection.mDeleteDocument: documents parameter format is invalid (should be an array of document IDs)');
        }

        $data = ['body' => ['ids' => $documentIds]];

        $response = $this->kuzzle->query(
            $this->buildQueryArgs('document', 'mDelete'),
            $this->kuzzle->addHeaders($data, $this->headers),
            $options
        );

        return $response['result'];
    }
1063192
function swift_get_secure_attachment_url( $post_id, $expires = 900, $size = null ) {
		return $this->swift_get_attachment_url( $post_id, $expires, $size = null );
	}
38059
def openattachment(self, attachid):
        
        attachments = self.get_attachments(None, attachid)
        data = attachments["attachments"][str(attachid)]
        xmlrpcbinary = data["data"]

        ret = BytesIO()
        ret.write(xmlrpcbinary.data)
        ret.name = data["file_name"]
        ret.seek(0)
        return ret
1313737
public function generateAttachmentMetadata($metadata, $attachment_id) {
		if(!$this->enabledAlternativeFormats) {
			return $metadata;
		}

		$mime = get_post_mime_type($attachment_id);
		if($mime == 'application/vnd.adobe.illustrator') {
			$file = get_attached_file($attachment_id);
			$fileName = pathinfo($file, PATHINFO_BASENAME);
			$fallback_sizes = array(
				'thumbnail',
				'medium',
				'medium_large',
				'large',
			);
			$fallback_sizes = apply_filters('fallback_intermediate_image_sizes', $fallback_sizes, $metadata);
			$additional_sizes = wp_get_additional_image_sizes();

			$metadata = [
				'sizes' => [
					'full' => [
						'file' => $fileName,
						'width' => null,
						'height' => null,
						'mime-type' => 'image/jpeg'
					]
				]
			];

			foreach($fallback_sizes as $sz) {
				$metadata['sizes'][$sz] = [
					'file' => $fileName,
					'width' => get_option("{$sz}_size_w"),
					'height' => get_option("{$sz}_size_h"),
					'mime-type' => 'image/jpeg'
				];
			}

			foreach($additional_sizes as $size => $sizeInfo) {
				if(isset($sizeInfo['crop']) && $sizeInfo['crop']) {
					$metadata['sizes'][$size] = [
						'file' => $fileName,
						'width' => $sizeInfo['width'],
						'height' => $sizeInfo['height'],
						'mime-type' => 'image/jpeg'
					];
				}
			}

			$upload_info = wp_upload_dir();
			$upload_path = $upload_info['basedir'];
			$metadata['file'] = trim(str_replace($upload_path, '', $file), '/');
		}

		return $metadata;
	}
837012
public static function getAttachmentIdFromUrl($attachmentUrl = '')
    {
        if (empty($attachmentUrl)) {
            return;
        }
        global $wpdb;
        $attachmentId = false;
        // Get the upload directory paths
        $upload_dir_paths = wp_upload_dir();
        // Make sure the upload path base directory exists in the attachment URL,
        // to verify that we're working with a media library image
        if (false !== strpos($attachmentUrl, $upload_dir_paths['baseurl'])) {
            // If this is the URL of an auto-generated thumbnail, get the URL of the original image
            $attachmentUrl = preg_replace('/-\d+x\d+(?=\.(jpg|jpeg|png|gif)$)/i', '', $attachmentUrl);
            // Remove the upload path base directory from the attachment URL
            $attachmentUrl = str_replace($upload_dir_paths['baseurl'] . '/', '', $attachmentUrl);
            // Finally, run a custom database query to get the attachment ID from the modified
            // attachment URL
            $attachmentId = $wpdb->get_var(
                $wpdb->prepare(
                    "SELECT wposts.ID
					FROM {$wpdb->posts} wposts, {$wpdb->postmeta} wpostmeta
					WHERE wposts.ID = wpostmeta.post_id
					AND wpostmeta.meta_key = '_wp_attached_file'
					AND wpostmeta.meta_value = '%s'
					AND wposts.post_type = 'attachment'", $attachmentUrl));
        }
        return $attachmentId;
    }
1047923
public function renderMedia($mediaId, array $options = array())
    {
        $media = $this->getMedia($mediaId);

        if ($media) {
            return $this->displayMediaManager->renderMedia($media, $options);
        }

        return '';
    }
452998
protected function getMemcached($connectionId, array $credentials, array $options)
    {
        $memcached = $this->createMemcachedInstance($connectionId);

        if (count($credentials) == 2) {
            $this->setCredentials($memcached, $credentials);
        }

        if (count($options)) {
            $memcached->setOptions($options);
        }

        return $memcached;
    }
416804
public function get_raw_body($uid, $fp=null, $part = null)
    {
        if (!$this->check_connection()) {
            return null;
        }

        return $this->conn->handlePartBody($this->folder, $uid,
            true, $part, null, false, $fp);
    }
1132491
public function getAttachment($attachmentName)
    {
        if ($attachmentName == '')
            throw new Exception('Attachment Name not specified');

        //build URI
        $strURI = Product::$baseProductUri . '/email/' . $this->getFileName() . '/attachments/' . $attachmentName;

        //sign URI
        $signedURI = Utils::sign($strURI);

        $responseStream = Utils::processCommand($signedURI, 'GET', '', '');

        $v_output = Utils::validateOutput($responseStream);

        if ($v_output === '') {
            $outputFilename = $attachmentName;
            Utils::saveFile($responseStream, AsposeApp::$outPutLocation . $outputFilename);
            return $outputFilename;
        } else {
            return $v_output;
        }
    }
1051270
public function deleteAttachment($id) {
		if(!StorageSettings::deleteFromStorage()) {
			return $id;
		}

		$data = wp_get_attachment_metadata($id);
		if(isset($data['file']) && !isset($data['s3'])) {
			return $id;
		}

		if($this->client && $this->client->enabled()) {
			if(!isset($data['file'])) {
				$file = get_attached_file($id);
				if($file) {
					if(strpos($file, 'http') === 0) {
						$pi = parse_url($file);
						$file = trim($pi['path'], '/');
						if(0 === strpos($file, $this->client->bucket())) {
							$file = substr($file, strlen($this->client->bucket())).'';
							$file = trim($file, '/');
						}
					} else {
						$pi = pathinfo($file);
						$upload_info = wp_upload_dir();
						$upload_path = $upload_info['basedir'];

						$file = trim(str_replace($upload_path, '', $pi['dirname']), '/').'/'.$pi['basename'];
					}

					$this->deleteFile($file);
				}
			} else {
			    $deletedFiles = [];

			    $deletedFiles[] = $data['s3']['key'];
				$this->deleteFile($data['s3']['key']);

				if(isset($data['sizes'])) {
					$pathParts = explode('/', $data['s3']['key']);
					array_pop($pathParts);
					$path_base = implode('/', $pathParts);

					foreach($data['sizes'] as $key => $size) {
						$file = arrayPath($size,'s3/key', false);
						if (!$file) {
						    $file = $path_base.'/'.$size['file'];
                        }

                        if (in_array($file, $deletedFiles)) {
					        Logger::info("File '$file' has already been deleted.");
					        continue;
                        }

                        $this->deleteFile($file);

						$deletedFiles[] = $file;
					}
				}
			}
		}

		return $id;
	}
1229235
public function getUrl($id, $options = [])
    {
        $cloudinary = $this->cloudinary;

        return $cloudinary::cloudinary_url($id, $options);
    }
924028
public function getCustomHTMLBody($callback = false) {
        $body = $this->getHtmlBody();
        if($body === null) return null;

        if ($callback !== false) {
            $aAttachment = $this->parent->getAttachments();
            $aAttachment->each(function($oAttachment) use(&$body, $callback) {
                /** @var Attachment $oAttachment */
                if(is_callable($callback)) {
                    $body = $callback($body, $oAttachment);
                }elseif(is_string($callback)) {
                    call_user_func($callback, [$body, $oAttachment]);
                }
            });
        }

        return $body;
    }
660030
public static String getAttachmentUrl(String applicationId, UUID callId, String attachmentName) {
        return String.format("%s%s/%s/%s", ATTACHMENT_URL_BASE, applicationId, callId.toString(), attachmentName);
    }
958112
public function view($attachmentId = null)
    {
        // FIXME cache previews
        $attachment = $this->Attachments->get($attachmentId);
        $this->_checkAuthorization($attachment);

        switch ($attachment->filetype) {
            case 'image/png':
            case 'image/jpg':
            case 'image/jpeg':
            case 'image/gif':
                $image = new \Imagick($attachment->getAbsolutePath());
                if (Configure::read('Attachments.autorotate')) {
                    $this->_autorotate($image);
                }
                break;
            case 'application/pdf':
                header('Content-Type: ' . $attachment->filetype);
                $file = new File($attachment->getAbsolutePath());
                echo $file->read();
                exit;
                break;
            default:
                $image = new \Imagick(Plugin::path('Attachments') . '/webroot/img/file.png');
                break;
        }

        $image->setImageFormat('png');
        $image->setImageCompression(\Imagick::COMPRESSION_JPEG);
        $image->setImageCompressionQuality(75);
        $image->stripImage();

        header('Content-Type: image/' . $image->getImageFormat());
        echo $image;

        $image->destroy();
        exit;
    }
291681
public function documentExists($documentId, array $options = [])
    {
        $data = [
            '_id' => $documentId
        ];

        $response = $this->kuzzle->query(
            $this->buildQueryArgs('document', 'exists'),
            $this->kuzzle->addHeaders($data, $this->headers),
            $options
        );

        return $response['result'];
    }
1008759
def attachment_show(self, id, **kwargs):
        ""
        api_path = "/api/v2/attachments/{id}.json"
        api_path = api_path.format(id=id)
        return self.call(api_path, **kwargs)