I need to be able to regenerate thumbnails on wordpress. As wordpress on Google App Engine uses Google Cloud Storage architecture the plugin ‘Regenerate Thumbnails’ does not work. My whole template relies on different sizes of the image.
Is there any modification of the Google app engine plugin that solves this problem?
Can I just add all the sizes I need into this collection I found in the function image_sizes() of the GAE plugin?
$images = [
'thumb' => [
'width' => intval( get_option( 'thumbnail_size_w' ) ),
'height' => intval( get_option( 'thumbnail_size_h' ) ),
'crop' => (bool) get_option( 'thumbnail_crop' )
],
'medium' => [
'width' => intval( get_option( 'medium_size_w' ) ),
'height' => intval( get_option( 'medium_size_h' ) ),
'crop' => false
],
'large' => [
'width' => intval( get_option( 'large_size_w' ) ),
'height' => intval( get_option( 'large_size_h' ) ),
'crop' => false
],
'full' => [
'width' => null,
'height' => null,
'crop' => false
]
];
Thanks
Ok, so GAE plugin for wordpress overwrites image_downsize function which calls a class method image_sizes() that builds the array $images showed above. $images is joined with the global variable $_wp_additional_image_sizes which contains a list of the sizes I thought I need to add manually to the array.
So, I answered my question by also figuring out that the image is retrieved from google cloud storage and the parameter =sXX-c is passed to the url where XX is the max value between width and heigh of the image and -c tells to crop the image.
Here the link : https://developers.google.com/appengine/docs/python/images/functions
And here is the part that explains the parameter:
URL Modifications:
=sXX
To resize an image, append =sXX to the end of the image URL, where XX is an integer from 0â1600 representing the new image size in pixels. The maximum size is defined in IMG_SERVING_SIZES_LIMIT. The API resizes the image to the supplied value, applying the specified size to the image’s longest dimension and preserving the original aspect ratio. For example, if you use =s32 to resize a 1200×1600 image, the resulting image is a 24×32. If that image were 1600×1200, the resized image would be 32×24 pixels.
=sXX-c
To crop and resize an image, append =sXX-c to the end of the image URL, where XX is an integer from 0â1600 representing the new image size in pixels. The maximum size is defined in IMG_SERVING_SIZES_LIMIT. The API resizes the image to the supplied value, applying the specified size to the image’s longest dimension and preserving the original aspect ratio. If the image is portrait, the API slices evenly from the top and bottom to make a square. If the image is landscape, the API slices evenly from the left and right to make a square. After cropping, the API resizes the image to the specified size.
My solution was to stick with the size what google storage retrieves and do some css work. (www.pukkaball.com)