Relative link Airtable images in WordPress URL’s
-
I made a small addition to the plugin.
Now you can use URL for images in WordPress like this:
https://ww100.atiks.org/?air_i=ww100nails_courses|NailProfessionals|recbmM8W6smWxyiT6|Foto|0where you send dynamyc parameters for image in Airtable
my code in functions.php:
//////////////
if ($_GET[‘air_i’] != ”) {$atts = explode(‘|’, $_GET[‘air_i’]);
$config = $atts[0];
$table = $atts[1];
$rid = $atts[2];
$field = $atts[3];
$index = $atts[4];$query = new AirpressQuery();
$query->setConfig($config);
$query->table($table)->view(”);
$query->addFilter(“{RECORD_ID}='”.$rid.”‘”);
$records = new AirpressCollection($query);
$file = $records[0][$field][$index];
if ($file[‘url’] == ”) {print(’empty’);exit;}$name = $file[‘url’];
$fp = fopen($name, ‘rb’);header(‘Cache-Control: no-cache, no-store, max-age=0, must-revalidate’);
header(‘Expires: January 01, 2013’); // Date in the past
header(‘Pragma: no-cache’);
header(“Content-Type: image/jpg”);fpassthru($fp);
exit;
}
//////////////////
- The topic ‘Relative link Airtable images in WordPress URL’s’ is closed to new replies.