Table Of Contents

Filter: custom cover size

Table Of Contents
Hook
peepso_filter_cover_sizes_to_delete

 

Plugin PeepSo Foundation
Since 1.11.4
Status Active
Args
array(int)

Description #

To use a custom cover size in your theme or plugin, simply pass an integer to PeepSoUser::get_cover($value). Custom sized images are generated on-the-fly and stored in the user’s directory.

If you do use custom cover images by passing an integer to PeepSoUser::get_cover(), you should hook into this filter to make sure your custom sized cover is deleted when the user removes it.

Examples #

Let’s say you use a custom sized cover of 666 somewhere in your plugin or theme:

1 2
// get a custom sized cover URL from PeepSo
$cover = PeepSoUser::get_instance()->get_cover(666);

Since PeepSo creates a file on-the-fly if needed, make sure the file is cleaned up when user removes his cover. To do that, you need to add your custom size to the array of integers.

1 2 3 4 5
// make sure PeepSo cleans up custom cover sizes upon deletion
add_filter('peepso_filter_cover_sizes_to_delete', function($sizes){
    $sizes[]=666;
    return($sizes);
});

What are your feelings
Updated on Sep 22, 2023