A conditional php function to check, shorten and combine three different database credits fields in a Digital Image Archive

Supplying images with correct but useable credits

Much of the work of the Robin & Lucienne Day Foundation’s Archive involves supplying good quality images for exhibitions, promotion and magazine/web articles. Providing easy-to-use credits with the images, is important to prevent press journalists omitting credits, or making them up inaccurately.

The material the Archive has mostly been generated by the Robin & Lucienne Day Foundation itself, by commissioning museum standard digital photography. But one of the things that makes collating standardised credits so difficult is that quite a number of the images were originally from sources other than the Foundation. As a result, although the Foundation owns the copyright to all of Robin & Lucienne Day’s designs, some organisations who may own partial rights to the actual photographs.

One example of this is where a design is in legitimate contemporary production: the producing company, such as Case Furniture with Robin Day’s 675 chair, may own copyright to images of their current production of the chair. Additionally a freelance photographer, may have credit rights. So that would be three parties that need mentioning in the credit, making it very long and tempting for the journalist to edit or disregard.

Image loan contract with credits

I have created an image loan contract function for the Archive management system, (more about the Archive project), which makes it simple to prepare a ‘shopping list’ of images for lenders such as a magazine editor, or a PR agency. This Listing contains the contractual information with a list of image filenames, thumbnails and accession numbers for identification, and the catalogue entry including required credits.

What I want to do, instead of echoing out up to three credits in longhand (our organisation’s credit, any third party credit, and any photographer credit) is to create a condensed version. I also want to check for the word “Copyright” and change it to the html symbol for copyright (&#169;) instead. Finally I need to make sure that our organisation receives a courtesy credit for holding and supplying the image, even if the copyright is held by a third party (with permission from them). The resulting credit can then be easily copied and pasted by our lenders without them having to question or edit it.

Taking all that into account, I’ve written a conditional function in php which I am sharing with you here.

Php conditional function

SET THE VARIABLES READY FOR THE RESULT

SET THE VARIABLES READY FOR THE RESULT

1

2

//First I set the variables that are going to be shown as the result of the function.

$us='';$thirdparty='';$photographer='';

FIND THE $us VARIABLE

FIND THE $us VARIABLE

1

2

3

4

5

6

7

8

9

10

11

12

$courtesy_array=array(2,3,5);// Set the array of identifiers which are in the database that show that the image is not our copyright, and should have a courtesy credit

if(($list['ownership_id'])!=''){//check there is something specified, if not a warning will be shown

if($list['ownership_id']==1){

$us='&#169;Our Organisation';//copyright (using the copyright symbol instead of the full word)

}

elseif(in_array($list['ownership_id'],$courtesy_array)){// if ownership anything other than copyright our organisation ie if the identifier is found in the $courtesy_array

$us='Our Organisation';

}

else{

$us='check credit';//warning where nothing was specified

}

}

FIND THE $thirdparty VARIABLE

FIND THE $thirdparty VARIABLE

1

2

3

4

5

6

7

8

9

10

11

12

$third_party_array=array(2,3,4););// Set the array of identifiers which are in the database that show that there are third party rights and some permission has been given

if((!empty($list['third_party_ownership']))&&($list['third_party_perms_to_us_id']==1)){//if there is something in third party ownership and no permission sought or given, show actual owner and a warning

$third='/Owner: $list['third_party_ownership'].',&nbsp;<strong>permission must be sought.</strong>';

}

if (in_array($list['third_party_perms_to_us_id'], $third_party_array)){//some sort of permission given

if (is_null($list['third_party_credits'])){//if they have asked us to use a credit, it will be it the third party credits field in the database

$third= '';

}

else{

$third= '/'.str_ireplace("copyright","&#169;",$list['third_party_credits']);//case insensitive on Copyright (replace the word copyright with the symbol)

}

}

FIND THE $photographer VARIABLE

FIND THE $photographer VARIABLE

1

2

3

4

5

6

7

8

9

10

11

if(strpos($list['third_party_credits'],$list['ph_name'])!==false){

$photographer='';//if third party credits already contains ph_name echo nothing because it is not necessary to restate the photographer