Perch Upload - cannot upload PDF files

  • Hi all,


    Hopefully the hive mind can help me here.


    I'm currently moving a Perch site from one server (Windows 2012 running MAMP) to another (Windows 2019 running MAMP Pro). So far, I've got everything working as it should, with the exception of uploading PDF files via the Assets screen.


    I've tested the upload using TXT, PNG, JPG etc, all work fine, however PDF files get uploaded in to the specified folder fine, but the user then gets logged out of the Perch interface. and no entry in to the database takes place. This seems to point to that the thumbnail for the PDF cannot be generated and causes a pretty hard PHP error. However, I'm seeing nothing in the PHP or Apache error logs.


    I've been digging around old forum posts, and read that this may be an indication that ImageMagick is not installed on the webserver. When I test for the ImageMagick version using...


    $imagick_version_string = $imagick_version['versionString'];


    I get this:


    ImageMagick 6.8.9-1 Q16 x86 2014-05-08 http://www.imagemagick.org


    In the extended diagnostics in Perch, I can see ImageMagick is loaded:


    Extensions: Core, bcmath, calendar, com_dotnet, ctype, date, filter, hash, iconv, json, SPL, odbc, pcre, Reflection, session, sockets, standard, mysqlnd, tokenizer, zip, zlib, libxml, dom, PDO, bz2, SimpleXML, soap, xml, xmlreader, xmlwriter, apache2handler, openssl, curl, fileinfo, gd, intl, mbstring, memcache, mysqli, Phar, pdo_mysql, pdo_sqlite, sqlite3, xsl, exif, imagick

    GD: Yes

    ImageMagick: Yes


    I'm stumped as to how to move forward with resolving this, can anyone help with any suggestions on how to resolve or any PHP to test ImageMagick or any of its dependants are actually working properly?


    Thanks in advance,


    Stoo

  • George G

    Approved the thread.
  • I am fairly sure that I successfully added PDF assets for which Perch did not generate thumbnails.


    Does the issue happen when you upload any PDF? Or are you only testing with the same PDF?


    And where does this happen? In a content region?

    Thanks for your reply.


    Apparently (according to Drew in an old post) turning off ImageMagick should turn off PDF thumbnail generation, however turning it off in MAMP Pro seems to make no difference for me. I'm only suspecting this is the issue as it's been mentioned in the forums before and I appear to have the very similar symptoms in that when I upload the PDF it saves it in the designated folder but Perch logs me out so looks to be a hard error crashing Apache or something.


    I've tried numerous PDF's, all are not large (under 1mb in size) and from various sources. All have the same outcome.


    This is happening when logged in to Perch, Assets, Add New Asset (in to any buckets I have configured).


    I feel I need to find a way to confirm ImageMagick is actually working in my installation. I can retrieve the version number (in my first post) but I'm not sure how I can test it. As far as I know uploading an image file doesn't use ImageMagick as Drew had previously mentioned images only use GD for resizing etc, PDF's use ImageMagick as GD can't handle PDF's.


    Any further thoughts or ways to test ImageMagick would be gratefully received.


    Cheers,

  • Update:


    After removing ImageMagick from PHP.INI, I've now got PDF's uploading. However, this now means that no images get a thumbnail (which kinda says GD isn't being used to thumbnail images as per Drew's explanation a while back). I guess my customer will have to live with that.


    I'd say this means that my instance of MAMP Pro was at fault here, possibly not compatible with Windows 2019 (which I'll take up with MAMP) but for anyone else getting this issue in the future here's some tips...


    In MAMP Pro, under Languages > PHP unticking Imagck/ImageMagick does not disable Imagemagick (which is what you'd expect it to do!!). To disable it you should go to the File menu (in MAMP Pro UI) > Edit Template > PHP > and select the version of PHP you're running. In the editor find "magick" and you'll find the line "MAMP_Imagick_MAMPextension=php_imagick.dll". Change this to be commented out by using a semi-colon to ";MAMP_Imagick_MAMPextension=php_imagick.dll" (without the quotes). Save the file, close the editor and restart the Apache service. This will disable it properly.


    You can confirm this is no longer loaded by checking Perch extended diagnostics for "ImageMagick: No".


    The next issue though is why are image thumbnails not being created if GD is loaded and should be working?