Collections functions
General functions
Node functions
Render functions
Theme permission functions
User functions
Resource functions

resource_random_jpg()

Parameters

ColumnTypeDefaultDescription
$resource
$width
$height

Location

include/test_functions.php lines 5 to 23

Definition

 
function resource_random_jpg($resource,$width$height)
    {
    
// Set random colours 
    
$bg_r =  mt_rand(0,255);
    
$bg_g mt_rand(0,255);
    
$bg_b mt_rand(0,255);

    
// Create image
    
$test_image imagecreate($width$height);
    
$text_r $bg_r 128 $bg_r 100 $bg_r 100;
    
$text_g $bg_g 128 $bg_g 100 $bg_g 100;
    
$text_b $bg_b 128 $bg_b 100 $bg_b 100;
    
$text_col imagecolorallocate($test_image$text_r$text_g$text_b);
    
imagestring($test_image52015,  'Image ' $resource$text_col);

    
$path get_resource_path($resource,true,'',true,'jpg');
    
imagejpeg($test_image$path,50);
    
create_previews($resource,false,'jpg');
    }

This article was last updated 29th May 2024 12:05 Europe/London time based on the source file dated 22nd May 2024 17:25 Europe/London time.