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.6 11.9 11.9.1 11.9.2 11.9.3 12.0 12.0.1 12.0.2 12.1 12.1.1 12.1.2 12.2 12.2.1 12.2.2 12.3 12.3.1 12.4 12.4.1 12.5 12.5.1 12.6 12.6.1 12.6.2 12.6.3 12.7 12.7.1 12.7.2 12.8 12.8.1 12.8.2 12.9 12.9.1 12.9.2 12.9.3 12.9.4 13.0 13.0.1 13.1 13.1.1 13.1.2 13.1.3 13.1.4 13.2 13.2.1 13.2.2 13.2.3 13.3 13.3.1 13.3.2 13.4 13.4.1 13.4.2 13.4.3 13.4.4 13.5 13.5.1 13.6 13.6.1 13.7 13.7.1 13.8 13.8.1 13.8.2 13.9 13.9.1 14.0 14.1 14.2 14.2.1 14.3 14.4 14.4.1 14.5 14.6 14.7 14.8 14.9 14.9.1 15.0 15.0.1 15.0.2 15.1 15.1.1 15.2 15.3 15.3.1 15.4 15.5 15.6 15.7 15.7-a.1 15.7-a.3 15.7-a.5 15.7-a.7 15.7-beta
jetpack / class.jetpack-post-images.php
jetpack Last commit date
3rd-party 1 week ago _inc 2 days ago css 2 weeks ago extensions 2 days ago images 1 month ago jetpack_vendor 2 days ago json-endpoints 1 week ago modules 2 days ago sal 1 week ago src 2 days ago vendor 2 days ago views 1 month ago CHANGELOG.md 2 days ago LICENSE.txt 5 months ago SECURITY.md 2 days ago class-jetpack-connection-status.php 2 years ago class-jetpack-gallery-settings.php 6 months ago class-jetpack-newsletter-dashboard-widget.php 6 months ago class-jetpack-pre-connection-jitms.php 2 years ago class-jetpack-stats-dashboard-widget.php 3 months ago class-jetpack-xmlrpc-methods.php 1 week ago class.frame-nonce-preview.php 6 months ago class.jetpack-admin.php 2 days ago class.jetpack-autoupdate.php 6 months ago class.jetpack-cli.php 2 days ago class.jetpack-client-server.php 2 years ago class.jetpack-gutenberg.php 1 week ago class.jetpack-heartbeat.php 3 months ago class.jetpack-modules-list-table.php 6 months ago class.jetpack-network-sites-list-table.php 6 months ago class.jetpack-network.php 1 month ago class.jetpack-plan.php 2 years ago class.jetpack-post-images.php 2 months ago class.jetpack-twitter-cards.php 3 months ago class.jetpack-user-agent.php 2 years ago class.jetpack.php 2 days ago class.json-api-endpoints.php 1 week ago class.json-api.php 2 weeks ago class.photon.php 3 years ago composer.json 2 days ago enhanced-open-graph.php 1 week ago functions.compat.php 3 months ago functions.cookies.php 2 years ago functions.global.php 2 days ago functions.is-mobile.php 2 years ago functions.opengraph.php 2 months ago functions.photon.php 2 years ago jetpack.php 2 days ago json-api-config.php 3 years ago json-endpoints.php 2 years ago load-jetpack.php 1 week ago locales.php 6 months ago readme.txt 2 days ago unauth-file-upload.php 6 months ago uninstall.php 6 months ago wpml-config.xml 3 years ago
class.jetpack-post-images.php
294 lines
1 <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName
2 /**
3 * Useful for finding an image to display alongside/in representation of a specific post.
4 *
5 * @deprecated 15.7 Use Automattic\Jetpack\Post_Media\Images instead.
6 * @package automattic/jetpack
7 */
8
9 use Automattic\Jetpack\Post_Media\Images;
10
11 /**
12 * Useful for finding an image to display alongside/in representation of a specific post.
13 *
14 * Includes a few different methods, all of which return a similar-format array containing
15 * details of any images found. Everything can (should) be called statically, it's just a
16 * function-bucket. You can also call Jetpack_PostImages::get_image() to cycle through all of the methods until
17 * one of them finds something useful.
18 *
19 * This file is included verbatim in Jetpack
20 *
21 * @deprecated 15.7 Use Automattic\Jetpack\Post_Media\Images instead.
22 *
23 * @see Automattic\Jetpack\Post_Media\Images
24 */
25 class Jetpack_PostImages {
26 /**
27 * If a slideshow is embedded within a post, then parse out the images involved and return them
28 *
29 * @deprecated 15.7 Use Automattic\Jetpack\Post_Media\Images::from_slideshow() instead.
30 *
31 * @param int $post_id Post ID.
32 * @param int $width Image width.
33 * @param int $height Image height.
34 * @return array Images.
35 */
36 public static function from_slideshow( $post_id, $width = 200, $height = 200 ) {
37 _deprecated_function( __METHOD__, '15.7', 'Automattic\Jetpack\Post_Media\Images::from_slideshow' );
38 return Images::from_slideshow( $post_id, $width, $height );
39 }
40
41 /**
42 * Filtering out images with broken URL from galleries.
43 *
44 * @deprecated 15.7 Use Automattic\Jetpack\Post_Media\Images::filter_gallery_urls() instead.
45 *
46 * @param array $galleries Galleries.
47 * @return array $filtered_galleries
48 */
49 public static function filter_gallery_urls( $galleries ) {
50 _deprecated_function( __METHOD__, '15.7', 'Automattic\Jetpack\Post_Media\Images::filter_gallery_urls' );
51 return Images::filter_gallery_urls( $galleries );
52 }
53
54 /**
55 * If a gallery is detected, then get all the images from it.
56 *
57 * @deprecated 15.7 Use Automattic\Jetpack\Post_Media\Images::from_gallery() instead.
58 *
59 * @param int $post_id Post ID.
60 * @param int $width Minimum image width to consider.
61 * @param int $height Minimum image height to consider.
62 * @return array Images.
63 */
64 public static function from_gallery( $post_id, $width = 200, $height = 200 ) {
65 _deprecated_function( __METHOD__, '15.7', 'Automattic\Jetpack\Post_Media\Images::from_gallery' );
66 return Images::from_gallery( $post_id, $width, $height );
67 }
68
69 /**
70 * Get attachment images for a specified post and return them. Also make sure
71 * their dimensions are at or above a required minimum.
72 *
73 * @deprecated 15.7 Use Automattic\Jetpack\Post_Media\Images::from_attachment() instead.
74 *
75 * @param int $post_id The post ID to check.
76 * @param int $width Image width.
77 * @param int $height Image height.
78 * @return array Containing details of the image, or empty array if none.
79 */
80 public static function from_attachment( $post_id, $width = 200, $height = 200 ) {
81 _deprecated_function( __METHOD__, '15.7', 'Automattic\Jetpack\Post_Media\Images::from_attachment' );
82 return Images::from_attachment( $post_id, $width, $height );
83 }
84
85 /**
86 * Check if a Featured Image is set for this post, and return it in a similar
87 * format to the other images?_from_*() methods.
88 *
89 * @deprecated 15.7 Use Automattic\Jetpack\Post_Media\Images::from_thumbnail() instead.
90 *
91 * @param int $post_id The post ID to check.
92 * @param int $width Image width.
93 * @param int $height Image height.
94 * @return array containing details of the Featured Image, or empty array if none.
95 */
96 public static function from_thumbnail( $post_id, $width = 200, $height = 200 ) {
97 _deprecated_function( __METHOD__, '15.7', 'Automattic\Jetpack\Post_Media\Images::from_thumbnail' );
98 return Images::from_thumbnail( $post_id, $width, $height );
99 }
100
101 /**
102 * Get images from Gutenberg Image blocks.
103 *
104 * @deprecated 15.7 Use Automattic\Jetpack\Post_Media\Images::from_blocks() instead.
105 *
106 * @param mixed $html_or_id The HTML string to parse for images, or a post id.
107 * @param int $width Minimum Image width.
108 * @param int $height Minimum Image height.
109 */
110 public static function from_blocks( $html_or_id, $width = 200, $height = 200 ) {
111 _deprecated_function( __METHOD__, '15.7', 'Automattic\Jetpack\Post_Media\Images::from_blocks' );
112 return Images::from_blocks( $html_or_id, $width, $height );
113 }
114
115 /**
116 * Very raw -- just parse the HTML and pull out any/all img tags and return their src
117 *
118 * @deprecated 15.7 Use Automattic\Jetpack\Post_Media\Images::from_html() instead.
119 *
120 * @param mixed $html_or_id The HTML string to parse for images, or a post id.
121 * @param int $width Minimum Image width.
122 * @param int $height Minimum Image height.
123 *
124 * @return array containing images
125 */
126 public static function from_html( $html_or_id, $width = 200, $height = 200 ) {
127 return Images::from_html( $html_or_id, $width, $height );
128 }
129
130 /**
131 * Data from blavatar.
132 *
133 * @deprecated 15.7 Use Automattic\Jetpack\Post_Media\Images::from_blavatar() instead.
134 *
135 * @param int $post_id The post ID to check.
136 * @param int $size Size.
137 * @return array containing details of the image, or empty array if none.
138 */
139 public static function from_blavatar( $post_id, $size = 96 ) {
140 _deprecated_function( __METHOD__, '15.7', 'Automattic\Jetpack\Post_Media\Images::from_blavatar' );
141 return Images::from_blavatar( $post_id, $size );
142 }
143
144 /**
145 * Gets a post image from the author avatar.
146 *
147 * @deprecated 15.7 Use Automattic\Jetpack\Post_Media\Images::from_gravatar() instead.
148 *
149 * @param int $post_id The post ID to check.
150 * @param int $size The size of the avatar to get.
151 * @param string|false $default The default image to use.
152 * @return array containing details of the image, or empty array if none.
153 */
154 public static function from_gravatar( $post_id, $size = 96, $default = false ) {
155 _deprecated_function( __METHOD__, '15.7', 'Automattic\Jetpack\Post_Media\Images::from_gravatar' );
156 return Images::from_gravatar( $post_id, $size, $default );
157 }
158
159 /**
160 * Run through the different methods that we have available to try to find a single good
161 * display image for this post.
162 *
163 * @deprecated 15.7 Use Automattic\Jetpack\Post_Media\Images::get_image() instead.
164 *
165 * @param int $post_id Post ID.
166 * @param array $args Other arguments (currently width and height required for images where possible to determine).
167 * @return array|null containing details of the best image to be used, or null if no image is found.
168 */
169 public static function get_image( $post_id, $args = array() ) {
170 return Images::get_image( $post_id, $args );
171 }
172
173 /**
174 * Get an array containing a collection of possible images for this post, stopping once we hit a method
175 * that returns something useful.
176 *
177 * @deprecated 15.7 Use Automattic\Jetpack\Post_Media\Images::get_images() instead.
178 *
179 * @param int $post_id Post ID.
180 * @param array $args Optional args, see defaults list for details.
181 * @return array containing images that would be good for representing this post
182 */
183 public static function get_images( $post_id, $args = array() ) {
184 _deprecated_function( __METHOD__, '15.7', 'Automattic\Jetpack\Post_Media\Images::get_images' );
185 return Images::get_images( $post_id, $args );
186 }
187
188 /**
189 * Takes an image and base pixel dimensions and returns a srcset for the
190 * resized and cropped images, based on a fixed set of multipliers.
191 *
192 * @deprecated 15.7 Use Automattic\Jetpack\Post_Media\Images::generate_cropped_srcset() instead.
193 *
194 * @param array $image Array containing details of the image.
195 * @param int $base_width Base image width (i.e., the width at 1x).
196 * @param int $base_height Base image height (i.e., the height at 1x).
197 * @param bool $use_widths Whether to generate the srcset with widths instead of multipliers.
198 * @return string The srcset for the image.
199 */
200 public static function generate_cropped_srcset( $image, $base_width, $base_height, $use_widths = false ) {
201 _deprecated_function( __METHOD__, '15.7', 'Automattic\Jetpack\Post_Media\Images::generate_cropped_srcset' );
202 return Images::generate_cropped_srcset( $image, $base_width, $base_height, $use_widths );
203 }
204
205 /**
206 * Takes an image URL and pixel dimensions then returns a URL for the
207 * resized and cropped image.
208 *
209 * @deprecated 15.7 Use Automattic\Jetpack\Post_Media\Images::fit_image_url() instead.
210 *
211 * @param string $src Image URL.
212 * @param int $width Image width.
213 * @param int $height Image height.
214 * @return string Transformed image URL
215 */
216 public static function fit_image_url( $src, $width, $height ) {
217 return Images::fit_image_url( $src, $width, $height );
218 }
219
220 /**
221 * Get HTML from given post content.
222 *
223 * @deprecated 15.7 Use Automattic\Jetpack\Post_Media\Images::get_post_html() instead.
224 *
225 * @param mixed $html_or_id The HTML string to parse for images, or a post id.
226 *
227 * @return array $html_info {
228 * @type string $html Post content.
229 * @type string $post_url Post URL.
230 * }
231 */
232 public static function get_post_html( $html_or_id ) {
233 _deprecated_function( __METHOD__, '15.7', 'Automattic\Jetpack\Post_Media\Images::get_post_html' );
234 return Images::get_post_html( $html_or_id );
235 }
236
237 /**
238 * Get info about a WordPress attachment.
239 *
240 * @deprecated 15.7 Use Automattic\Jetpack\Post_Media\Images::get_attachment_data() instead.
241 *
242 * @param int $attachment_id Attachment ID.
243 * @param string $post_url URL of the post, if we have one.
244 * @param int $width Minimum Image width.
245 * @param int $height Minimum Image height.
246 * @return array|bool Image data or false if unavailable.
247 */
248 public static function get_attachment_data( $attachment_id, $post_url, $width, $height ) {
249 _deprecated_function( __METHOD__, '15.7', 'Automattic\Jetpack\Post_Media\Images::get_attachment_data' );
250 return Images::get_attachment_data( $attachment_id, $post_url, $width, $height );
251 }
252
253 /**
254 * Get the alt text for an image or other media from the Media Library.
255 *
256 * @deprecated 15.7 Use Automattic\Jetpack\Post_Media\Images::get_alt_text() instead.
257 *
258 * @param int $attachment_id The Post ID of the media.
259 * @return string The alt text value or an empty string.
260 */
261 public static function get_alt_text( $attachment_id ) {
262 _deprecated_function( __METHOD__, '15.7', 'Automattic\Jetpack\Post_Media\Images::get_alt_text' );
263 return Images::get_alt_text( $attachment_id );
264 }
265
266 /**
267 * Determine the size to use with Photon for a thumbnail image.
268 * Images larger than the maximum thumbnail dimension in either dimension are resized to maintain aspect ratio.
269 *
270 * @deprecated 15.7 Use Automattic\Jetpack\Post_Media\Images::determine_thumbnail_size_for_photon() instead.
271 *
272 * @param int $width Original image width.
273 * @param int $height Original image height.
274 * @return array Array containing the width and height to use with Photon (null means auto).
275 */
276 public static function determine_thumbnail_size_for_photon( $width, $height ) {
277 _deprecated_function( __METHOD__, '15.7', 'Automattic\Jetpack\Post_Media\Images::determine_thumbnail_size_for_photon' );
278 return Images::determine_thumbnail_size_for_photon( $width, $height );
279 }
280
281 /**
282 * Function to provide the maximum dimension for a thumbnail image.
283 * Filterable via the `jetpack_post_images_max_dimension` filter.
284 *
285 * @deprecated 15.7 Use Automattic\Jetpack\Post_Media\Images::get_max_thumbnail_dimension() instead.
286 *
287 * @return int The maximum dimension for a thumbnail image.
288 */
289 public static function get_max_thumbnail_dimension() {
290 _deprecated_function( __METHOD__, '15.7', 'Automattic\Jetpack\Post_Media\Images::get_max_thumbnail_dimension' );
291 return Images::get_max_thumbnail_dimension();
292 }
293 }
294