Forum

Thread tagged as: Question, Problem, Error

Getting MIME type of image

Hello,

I'm trying to get the MIME type of an image using the following template code:

<perch:content id="thumbnail" output="mime" type="image" />

According to the Perch image documentation, this should return the MIME type of the image, but instead I get the following error:

Notice: undefined index mime in [root]/perch/core/lib/PerchFieldTypes.class.php on line 1214

Other output types like 'size' work just fine. The documentation does say that the MIME type of the image will be returned "if known"... is the error occurring because the MIME type is unknown?

Nicole Mirea

Nicole Mirea 2 points

  • 6 years ago

Nicole. Is the image file type listed in the perch/config/filetype.ini file. Try this with a known filetype that is on the list and see if you still get this error. Also, is the perch installation on a windows based server or something like xampp because if so you need to enable a setting for this to work. This was the case with my development environment. I just have to remember the setting...

Drew McLellan

Drew McLellan 2638 points
Perch Support

That would occur if the mime type hasn't been detected, yes. Are you using GD or Imagick for image processing?

I'm using ImageMagick, and the file is a JPG.

Rachel Andrew

Rachel Andrew 394 points
Perch Support

Can we see your Diagnostic Report please?

Thanks Rachel,

Here is our latest Diagnostic Report. I masked somethings in the report.


Perch Runway: 2.8.6 Production mode: Production (100) Installed apps: content (2.8.6), assets (2.8.6), categories (2.8.6), perch_blog (4.6), collection_4 (2.8.6), perch_events (1.9.2), perch_forms (1.8.3), perch_gallery (2.8.6), collection_1 (2.8.6), collection_5 (2.8.6), perch_podcasts (1.1), perch_backup (1.2) DB driver: PDO DB tables: perch2_backup_plans, perch2_backup_resources, perch2_backup_runs, perch2_blog_authors, perch2_blog_categories, perch2_blog_comments, perch2_blog_posts, perch2_blog_posts_to_categories, perch2_blog_posts_to_tags, perch2_blog_sections, perch2_blog_tags, perch2_categories, perch2_category_counts, perch2_category_sets, perch2_collection_index, perch2_collection_items, perch2_collection_revisions, perch2_collections, perch2_content_index, perch2_content_items, perch2_content_regions, perch2_events, perch2_events_categories, perch2_events_to_categories, perch2_forms, perch2_forms_responses, perch2_gallery_albums, perch2_gallery_image_versions, perch2_gallery_images, perch2_navigation, perch2_navigation_pages, perch2_page_routes, perch2_page_templates, perch2_pages, perch2_podcasts, perch2_podcasts_downloads, perch2_podcasts_episodes, perch2_resource_log, perch2_resource_tags, perch2_resources, perch2_resources_to_tags, perch2_scheduled_tasks, perch2_settings, perch2_user_privileges, perch2_user_role_privileges, perch2_user_roles, perch2_users Users: 9 App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_blog', 'perch_events', 'perch_podcasts', 'perch_forms', ); ?> Scheduled tasks for perch_events: update_category_counts (60 mins) Scheduled tasks for perch_blog: delete_spam_comments (1440 mins) Scheduled tasks for Backup: plan_1 (10 mins) Editor plug-ins: markitup, redactor H1: 9acb2860a1906924cfdeb67a48477c20 L1: 3a51249d4b6c6cf1f137122e2b364b67 headerColour: #ffffff content_singlePageEdit: 1 helpURL: siteURL: / hideBranding: 1 content_collapseList: 1 lang: en-gb update_2.2.7: done latest_version: 2.8 perch_blog_post_url: /news/{postSlug} perch_blog_update: 5.0 perch_gallery_update: 2.8.5 headerScheme: light dashboard: 0 perch_gallery_bucket_mode: dynamic perch_gallery_bucket: default perch_events_detail_url: {eventID} perch_blog_slug_format: %Y-%m-%d-{postTitle} perch_blog_akismet_key: *********** content_hideNonEditableRegions: 1 perch_gallery_basicUpload: 0 perch_blog_comment_notify: 1 update_2.2.9: done perch_members_login_page: /members/login.php?r={returnURL} update_2.2.11: done perch_blog_max_spam_days: 7 update_2.3: done update_2.3.2: done perch_events_update: 1.8 update_2.3.3: done on_sale_version: 2.8.6 update_2.3.4: done update_2.4.1: done update_2.4.2: done content_frontend_edit: 1 update_2.4.3: done logoPath: ******** update_2.4.4: done update_2.4.5: done update_2.4.6: done update_2.4.7: done update_2.4.9: done update_2.5.1: done update_2.5.2: done update_2.5.3: done update_2.5.4: done update_2.6: done hide_pwd_reset: 0 update_2.6.2: done update_2.6.3: done update_2.6.5: done update_2.6.6: done update_2.7: done update_2.7.1: done update_2.7.2: done update_2.7.3: done update_2.7.4: done update_2.7.6: done update_2.7.7: done update_2.7.8: done update_2.7.9: done update_2.7.10: done update_2.8.2: done perch_backup_mysqldump_path: ******** update_2.8.3: done update_2.8.4: done update_2.8.5: done update_runway_2.8.6: done PERCH_DEVELOPMENT: 10 PERCH_STAGING: 50 PERCH_PRODUCTION: 100 PERCH_DB_USERNAME: ******** PERCH_DB_SERVER: *********** PERCH_DB_DATABASE: ******** PERCH_DB_PREFIX: perch2_ PERCH_SITEPATH: ******** PERCH_EMAIL_FROM: ******** PERCH_EMAIL_FROM_NAME: ******** PERCH_SCHEDULE_SECRET: ******** PERCH_LOGINPATH: /perch PERCH_PATH: ******** PERCH_CORE: ******** PERCH_RESFILEPATH: ******** PERCH_RESPATH: ******** PERCH_HTML5: 1 PERCH_TZ: America/Los_Angeles PERCH_CLEAN_RESOURCES: true PERCH_RUNWAY: 1 PERCH_ERROR_MODE: DIE PERCH_DATE_LONG: %d %B %Y PERCH_DATE_SHORT: %d %b %Y PERCH_TIME_SHORT: %H:%M PERCH_TIME_LONG: %H:%M:%S PERCH_DEBUG: PERCH_PREVIEW_ARG: preview PERCH_TEMPLATE_PATH: ******** PERCH_DEFAULT_DOC: index.php PERCH_DEFAULT_EXT: .php PERCH_PRODUCTION_MODE: 100 PERCH_RWD: PERCH_HTML_ENTITIES: PERCH_SSL: PERCH_STRIPSLASHES: PERCH_PROGRESSIVE_FLUSH: 1 PERCH_AUTH_PLUGIN: PERCH_DB_CHARSET: utf8 PERCH_DB_PORT: PERCH_DB_SOCKET: HOSTING SETTINGS PHP: 5.4.37 Zend: 2.4.0 OS: Linux SAPI: apache2handler Safe mode: not detected MySQL client: 5.1.59 MySQL server: 5.5.41-cll-lve Extensions: Core, date, ereg, libxml, openssl, pcre, zlib, bz2, calendar, ctype, hash, filter, ftp, gettext, gmp, SPL, iconv, Reflection, session, standard, shmop, SimpleXML, sockets, mbstring, tokenizer, xml, apache2handler, imagick, curl, dom, fileinfo, gd, json, exif, mysql, mysqli, PDO, pdo_mysql, pdo_sqlite, Phar, sqlite3, wddx, xmlreader, xmlwriter, xsl, zip, mhash GD: Yes ImageMagick: Yes PHP max upload size: 250M PHP max form post size: 250M PHP memory limit: 256M Total max uploadable file size: 250M Resource folder writeable: Yes Session timeout: 24 minutes Native JSON: Yes Filter functions: Yes Transliteration functions: No HTTP_HOST: www.environment.ucla.edu HTTP_CONNECTION: keep-alive HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8 HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 HTTP_DNT: 1 HTTP_REFERER: ******** HTTP_ACCEPT_ENCODING: gzip, deflate, sdch HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.8 HTTP_COOKIE: _ga=GA1.2.413469215.1428340697; PHPSESSID=05q494r8ivpuoc71gj1gck9fv7; cmsa=1; cmssb=0 PATH: /sbin:/usr/sbin:/bin:/usr/bin SERVER_SIGNATURE: ******** SERVER_SOFTWARE: Apache SERVER_NAME: ******** SERVER_ADDR: ******** SERVER_PORT: 80 REMOTE_ADDR: ******** DOCUMENT_ROOT: ******** SERVER_ADMIN: ******** SCRIPT_FILENAME: ******** REMOTE_PORT: 50381 GATEWAY_INTERFACE: CGI/1.1 SERVER_PROTOCOL: HTTP/1.1 REQUEST_METHOD: GET QUERY_STRING: extended REQUEST_URI: /perch/core/settings/diagnostics/?extended SCRIPT_NAME: /perch/core/settings/diagnostics/index.php PHP_SELF: /perch/core/settings/diagnostics/index.php REQUEST_TIME_FLOAT: 1430888564.678 REQUEST_TIME: 1430888564