You are here

function pdf_to_image_escapeshellarg in PDF to ImageField 7.3

Wrapper to escapeshellargs to handle non-ASCII filenames.

Stolen from https://www.drupal.org/node/1502924

for imagemagick module issue, for Drupal core issue.

See also

https://drupal.org/node/1502924

https://drupal.org/node/1561214

2 calls to pdf_to_image_escapeshellarg()
pdf_to_image_convert_exec in ./pdf_to_image.module
Actually execute the shell command.
pdf_to_image_count_pages in ./pdf_to_image.module
Use imagemagick routine to count the number of pages in a given PDF.

File

./pdf_to_image.module, line 820
Generates thumbnail image(s) from an uploaded PDF.

Code

function pdf_to_image_escapeshellarg($arg) {
  $old_locale = setlocale(LC_CTYPE, 0);
  setlocale(LC_CTYPE, 'C.UTF-8');
  $arg_escaped = escapeshellarg($arg);
  setlocale(LC_CTYPE, $old_locale);
  return $arg_escaped;
}