Forum

Thread tagged as: Problem, Configuration, Blog

imageclasses doesn't add the desired class when uploading images through the mar...

Hi,

I'm currently having some troubles adding a class (img-responsive) to all of the images that are being uploaded by my client. The desired outcome is that when my client uploads an image in the editor, perch adds the bootstrap class img-responsive so that the image scales nicely to different screen sizes.

With my current setup that doesn't happen. I've been able to resize the image using the imageheight and imagewidth, but I don't want a fixed size.

<article class="h-entry">
    <div class="container-fullwidth">
    <section>
        <div class="col-lg-12 text-center" id="class-header-text">

            <h1 id="meta-header">
            <perch:blog id="postTitle" type="text" label="Title" required="true" size="xl autowidth" order="1" />
            </h1>

            <p class="meta" id="meta-par">
        Posted <time class="dt-published" datetime="<perch:blog id="postDateTime" type="date" label="Date" time="true" format="Y-m-d H:i:s" divider-before="Publishing" />">
            <perch:blog id="postDateTime" type="date" time="true" format="%d %B %Y" /> 
        </time>
        <!-- <perch:if exists="authorGivenName">
            by <span class="p-author h-card"><perch:blog id="authorGivenName" type="hidden" /> <perch:blog id="authorFamilyName" type="hidden" /></span>
        </perch:if>    -->
        <perch:categories id="categories" set="blog" label="Categories" display-as="checkboxes">
            in <a href="archive.php?cat=<perch:category id="catSlug" type="slug" />" class="p-category">
                <perch:category id="catTitle" type="text" />
            </a>
        </perch:categories>
    </p>
        </div>
    </section>
    </div>
    <div class="container-fullwidth">
    <section class="">
        <div class="description e-content">
            <perch:blog id="postDescHTML" type="textarea" label="Post" order="2" editor="markitup" markdown="true" size="xxl autowidth" required="true" imageclasses="img-responsive"/>
        </div>
    </section>
    </div>
</article>

<perch:blog id="excerpt" type="textarea" label="Excerpt" markdown="true" order="3" suppress="true" size="s" />

Diagnostic report

SELECT u.*, r.* FROM perch3_users u, perch3_user_roles r WHERE u.roleID=r.roleID AND u.userEnabled=1 AND u.userID=1 AND u.userHash='f24b5e907f65cfbaad7f304f4c4f694f' LIMIT 1
UPDATE perch3_users SET userHash='5fddc01e79ff0ad3fc133233afe7ed0e' WHERE userID='1'
[32] SELECT settingID, settingValue, userID FROM perch3_settings WHERE userID=1 OR userID=0 ORDER BY userID ASC
[8] SELECT itemValue FROM perch3_menu_items WHERE itemType='app'
[0] SELECT COUNT(*) FROM perch3_blog_comments WHERE commentStatus='PENDING'
[1] SELECT * FROM perch3_blog_authors WHERE authorEmail='johanerlandsson2@gmail.com' LIMIT 1
[1] SELECT * FROM perch3_blog_posts WHERE postID=4
[1] SELECT * FROM perch3_blog_sections ORDER BY sectionTitle ASC
[1] SELECT * FROM perch3_blogs ORDER BY blogTitle ASC
[1] SELECT * FROM perch3_blogs WHERE blogID=1 LIMIT 1
[1] SELECT * FROM perch3_blog_sections WHERE blogID='1' ORDER BY sectionTitle ASC
Using template: \templates\blog\post.html
Edit mode: edit
[1] SELECT mi.*, p.privKey FROM perch3_menu_items mi LEFT JOIN perch3_user_privileges p ON mi.privID=p.privID WHERE mi.itemActive=1 AND mi.parentID=0 ORDER BY itemOrder ASC LIMIT 0, 1
[3] SELECT mi.*, p.privKey FROM perch3_menu_items mi LEFT JOIN perch3_user_privileges p ON mi.privID=p.privID WHERE mi.itemActive=1 AND mi.parentID=1 ORDER BY mi.itemOrder ASC
[1] SELECT itemTitle FROM perch3_menu_items WHERE itemType='app' AND itemValue='perch_blog' LIMIT 1
[1] SELECT mi.*, p.privKey FROM perch3_menu_items mi LEFT JOIN perch3_user_privileges p ON mi.privID=p.privID WHERE mi.itemActive=1 AND mi.parentID=0 ORDER BY itemOrder ASC LIMIT 1, 10
[2] SELECT mi.*, p.privKey FROM perch3_menu_items mi LEFT JOIN perch3_user_privileges p ON mi.privID=p.privID WHERE mi.itemActive=1 AND mi.parentID=2 ORDER BY mi.itemOrder ASC
File: \addons\apps\perch_blog\modes\edit.post.php
[1] SELECT * FROM perch3_resources WHERE resourceID='77' LIMIT 1

Array
(
    [assetID] => 77
    [title] => Fitness runner
    [_default] => /perch/resources/fitness-runner.jpg
    [bucket] => default
    [path] => fitness-runner.jpg
    [size] => 770080
    [w] => 5472
    [h] => 3648
    [mime] => image/jpeg
    [sizes] => Array
        (
            [thumb] => Array
                (
                    [w] => 150
                    [h] => 100
                    [target_w] => 150
                    [target_h] => 150
                    [density] => 2
                    [path] => fitness-runner-thumb@2x.jpg
                    [size] => 17310
                    [mime] => image/jpeg
                    [assetID] => 78
                )

            [w50h50c1] => Array
                (
                    [w] => 50
                    [h] => 50
                    [target_w] => 50
                    [target_h] => 50
                    [crop] => true
                    [density] => 1
                    [path] => fitness-runner-w50h50.jpg
                    [size] => 1883
                    [mime] => 
                    [assetID] => 79
                )

        )

)

[5] SELECT * FROM perch3_categories c, perch3_category_sets s WHERE c.setID=s.setID AND s.setSlug='blog' ORDER BY catTreePosition ASC
Queries: 19
Memory: 3.5693

Array
(
    [type] => 2
    [message] => count(): Parameter must be an array or an object that implements Countable
    [file] => C:\xampp\htdocs\perch\core\lib\PerchFieldTypes.class.php
    [line] => 43
)
Johan Erlandsson

Johan Erlandsson 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Can you post your diagnostic report?

    Perch LTM: 3.0.13
    Production mode: Production (100)
    Installed apps: content (3.0.13), assets (3.0.13), categories (3.0.13), perch_blog (5.6.1), perch_events (1.9.5)
    DB driver: PDO
    DB tables: perch3_blog_authors (1), perch3_blog_comments (0), perch3_blog_index (137), perch3_blog_posts (4), perch3_blog_posts_to_tags (3), perch3_blog_sections (1), perch3_blog_tags (3), perch3_blog_webmention_queue (0), perch3_blogs (1), perch3_categories (5), perch3_category_counts (4), perch3_category_sets (1), perch3_content_index (165), perch3_content_items (100), perch3_content_regions (44), perch3_events (0), perch3_events_categories (0), perch3_events_to_categories (0), perch3_menu_items (10), perch3_navigation (0), perch3_navigation_pages (0), perch3_page_templates (1), perch3_pages (9), perch3_resource_log (11), perch3_resource_tags (0), perch3_resources (68), perch3_resources_to_tags (0), perch3_settings (32), perch3_user_passwords (0), perch3_user_privileges (37), perch3_user_role_privileges (2), perch3_user_roles (2), perch3_users (1)
    Users: 1
    App runtimes:

    <?php
        $apps_list = [ 
        'perch_blog', 
        'perch_events'
        ];

    Scheduled tasks for perch_blog: delete_spam_comments (1440 mins), publish_posts (1 mins), process_webmentions (1 mins)
    Editor plug-ins:
    H1: 421aa90e079fa326b6494f812ad13e79
    L1: b350927c616c855a5efccf1931f47d0c
    F1: 3b606135b33e6a102526838f4152a807
    headerColour: #ffffff
    content_singlePageEdit: 1
    helpURL:
    siteURL: /
    hideBranding: 0
    content_collapseList: 1
    lang: en-gb
    installedAt: 3.0.13
    update_3.0.13: done
    latest_version:
    on_sale_version: 3.1.1
    perch_blog_update: 5.6
    perch_blog_post_url: /blog/post.php?s={postSlug}
    perch_events_update: 1.8
    headerScheme: light
    perch_blog_site_name:
    perch_blog_slug_format: %Y-%m-%d-{postTitle}
    perch_blog_akismet_key:
    perch_blog_max_spam_days: 1
    perch_events_detail_url: /events/event.php?s={eventSlug}
    dashboard: 0
    sidebar_back_link: 1
    hide_pwd_reset: 0
    keyboardShortcuts: 0
    content_hideNonEditableRegions: 0
    content_frontend_edit: 0
    content_skip_region_list: 0
    assets_restrict_buckets: 0
    perch_blog_comment_notify: 0
    perch_blog_webmention_tx: 0
    perch_blog_webmention_rx: 0
    logoPath: /perch/resources/aft-logo.png
    PERCH_DEVELOPMENT: 10
    PERCH_STAGING: 50
    PERCH_PRODUCTION: 100
    PERCH_DB_USERNAME: root
    PERCH_DB_SERVER: localhost
    PERCH_DB_DATABASE: db_perch
    PERCH_DB_PREFIX: perch3_
    PERCH_TZ: UTC
    PERCH_EMAIL_FROM: johanerlandsson2@gmail.com
    PERCH_EMAIL_FROM_NAME: admin admin
    PERCH_LOGINPATH: /perch
    PERCH_PATH: C:\xampp\htdocs\perch
    PERCH_CORE: C:\xampp\htdocs\perch\core
    PERCH_RESFILEPATH: C:\xampp\htdocs\perch\resources
    PERCH_RESPATH: /perch/resources
    PERCH_HTML5: 1
    PERCH_DEBUG: 1
    PERCH_RWD: 1
    PERCH_RUNWAY:
    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_RUNWAY_ROUTED:
    PERCH_STRONG_PASSWORDS:
    PERCH_ASSET_VERSION: f704e7442d11292c99b5
    PERCH_PREVIEW_ARG: preview
    PERCH_TEMPLATE_PATH: C:\xampp\htdocs\perch\templates
    PERCH_TEMPLATE_FILTERS:
    PERCH_DEFAULT_DOC: index.php
    PERCH_DEFAULT_EXT: .php
    PERCH_PRODUCTION_MODE: 100
    PERCH_XHTML_MARKUP:
    PERCH_HTML_ENTITIES:
    PERCH_SSL:
    PERCH_STRIPSLASHES:
    PERCH_PROGRESSIVE_FLUSH: 1
    PERCH_PARANOID:
    PERCH_FORCE_SECURE_COOKIES:
    PERCH_DEFAULT_BUCKET: default
    PERCH_TRANSLATION_ASSIST:
    PERCH_PASSWORD_MIN_LENGTH: 6
    PERCH_MAX_FAILED_LOGINS: 10
    PERCH_AUTH_LOCKOUT_DURATION: 1 HOUR
    PERCH_VERIFY_UPLOADS:
    PERCH_PRIV_ASSIST:
    PERCH_CUSTOM_EDITOR_CONFIGS:
    PERCH_ENABLE_EXIF: 1
    PERCH_AUTH_PLUGIN:
    PERCH_DB_CHARSET: utf8
    PERCH_DB_PORT:
    PERCH_DB_SOCKET:
    PERCH_APPS_EDITOR_PLUGIN: markitup
    PERCH_APPS_EDITOR_MARKUP_LANGUAGE: markdown

Hosting settings

    PHP: 7.2.1
    Zend: 3.2.0
    OS: WINNT
    SAPI: apache2handler
    Safe mode: not detected
    MySQL client: mysqlnd 5.0.12-dev - 20150407 - $Id: b396954eeb2d1d9ed7902b8bae237b287f21ad9e $
    MySQL server: 5.5.5-10.1.30-MariaDB
    Free disk space: 5.99 GB
    Extensions: Core, bcmath, calendar, ctype, date, filter, hash, iconv, json, SPL, pcre, readline, Reflection, session, standard, mysqlnd, tokenizer, zip, zlib, libxml, dom, PDO, bz2, SimpleXML, xml, wddx, xmlreader, xmlwriter, apache2handler, openssl, curl, fileinfo, gd, gettext, mbstring, exif, mysqli, pdo_mysql, pdo_sqlite, Phar, ftp
    GD: Yes
    ImageMagick: No
    PHP max upload size: 2M
    PHP max form post size: 8M
    PHP memory limit: 128M
    Total max uploadable file size: 2M
    Resource folder writeable: Yes
    Session timeout: 24 minutes
    Native JSON: Yes
    Filter functions: Yes
    Transliteration functions: No
    MIBDIRS: C:/xampp/php/extras/mibs
    MYSQL_HOME: \xampp\mysql\bin
    OPENSSL_CONF: C:/xampp/apache/bin/openssl.cnf
    PHP_PEAR_SYSCONF_DIR: \xampp\php
    PHPRC: \xampp\php
    TMP: \xampp\tmp
    HTTP_HOST: localhost
    HTTP_USER_AGENT: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0
    HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
    HTTP_ACCEPT_LANGUAGE: en-US,en;q=0.5
    HTTP_ACCEPT_ENCODING: gzip, deflate
    HTTP_REFERER: https://localhost/perch/core/settings/diagnostics/
    HTTP_COOKIE: cmsa=1; PHPSESSID=i9jub6f8ht3895kr3qhersddtm
    HTTP_CONNECTION: keep-alive
    HTTP_UPGRADE_INSECURE_REQUESTS: 1
    HTTP_DNT: 1
    PATH: C:\ProgramData\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files\dotnet\;C:\Program Files\Git\cmd;C:\Program Files\nodejs\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\PuTTY\;C:\Users\Johan Erlandsson\AppData\Local\Microsoft\WindowsApps;C:\Users\Johan Erlandsson\AppData\Roaming\npm;
    SystemRoot: C:\WINDOWS
    COMSPEC: C:\WINDOWS\system32\cmd.exe
    PATHEXT: .COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
    WINDIR: C:\WINDOWS
    SERVER_SIGNATURE: <address>Apache/2.4.29 (Win32) OpenSSL/1.1.0g PHP/7.2.1 Server at localhost Port 80</address>
    SERVER_SOFTWARE: Apache/2.4.29 (Win32) OpenSSL/1.1.0g PHP/7.2.1
    SERVER_NAME: localhost
    SERVER_ADDR: ::1
    SERVER_PORT: 80
    REMOTE_ADDR: ::1
    DOCUMENT_ROOT: C:/xampp/htdocs
    REQUEST_SCHEME: http
    CONTEXT_DOCUMENT_ROOT: C:/xampp/htdocs
    SERVER_ADMIN: postmaster@localhost
    SCRIPT_FILENAME: C:/xampp/htdocs/perch/core/settings/diagnostics/index.php
    REMOTE_PORT: 25768
    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: 1523331494.081
    REQUEST_TIME: 1523331494