Coding standards
Security in ResourceSpace
Developer reference
Database
Action functions
Admin functions
Ajax functions
Annotation functions
API functions
Collections functions
Comment functions
Config functions
CSV export functions
Dash functions
Debug functions
Encryption functions
Facial recognition functions
File functions
General functions
Language functions
Log functions
Login functions
Message functions
Migration functions
Node functions
PDF functions
Plugin functions
Render functions
Reporting functions
Request functions
Research functions
Slideshow functions
Theme permission functions
User functions
Video functions
Database functions
Metadata functions
Resource functions
Search functions
Map functions
Job functions
Tab functions
Test 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 15th September 2024 16:35 Europe/London time based on the source file dated 22nd May 2024 17:25 Europe/London time.