Forum

Thread tagged as: Question, Problem

Image cropping not working in this instance...

I have the template that is part of a perch: blocks region:

<perch:block type="cruise_photos" label="Cruise Photos" icon="photos">
                        <div class="detail-top slider-wth-thumbs style-1 arrows">
                        <div class="swiper-container thumbnails-preview" data-autoplay="0" data-loop="1" data-speed="500" data-center="0" data-slides-per-view="1">
                            <div class="swiper-wrapper">
                                <perch:repeater id="cruise_photos" label="Cruise Photos">
                                <div class="swiper-slide <perch:if exists="perch_item_first">active</perch:if>" data-val="<perch:content id="perch_item_zero_index" type="hidden" />">
                                     <img class="img-responsive img-full" src="<perch:content id="cruise_photo" type="image" label="Cruise Photo Images" width="770" height="455" crop="true" />" alt="">
                                </div>
                                </perch:repeater>
                            </div>
                            <div class="pagination pagination-hidden"></div>
                            <div class="arrow-wrapp arr-s-3">
                                <div class="swiper-arrow-left sw-arrow"><span class="fa fa-angle-left"></span></div>
                                <div class="swiper-arrow-right sw-arrow"><span class="fa fa-angle-right"></span></div>
                            </div>
                        </div>
                        <div class="swiper-container thumbnails" data-autoplay="0" 
                        data-loop="0" data-speed="500" data-center="0" 
                        data-slides-per-view="responsive" data-xs-slides="3" 
                        data-sm-slides="5" data-md-slides="5" data-lg-slides="5" 
                        data-add-slides="5">
                            <div class="swiper-wrapper">
                                <perch:repeater id="cruise_photos" label="Cruise Photos">
                                <div class="swiper-slide <perch:if exists="perch_item_first">current active</perch:if>" data-val="<perch:content id="perch_item_zero_index" type="hidden" />">
                                    <img class="img-responsive img-full" src="<perch:content id="cruise_photo" type="image" label="Cruise Photo Images" width="154" height="101" crop="true" />" alt="">
                                </div>
                                </perch:repeater>
                            </div>
                            <div class="pagination hidden"></div>
                        </div>
                    </div>
 </perch:block>

What's happening is that in the first instance of the repeater with ID="cruise_photos", I'm getting images without the width and height as part of their filename (/perch/resources/p1030677.jpg) and in the second instance of the same repeater the image names are getting the width and height as part of their filename correctly (/perch/resources/img2620-w154h101.jpg).

If you notice, I was trying to have the images display twice by calling the repeater twice, first with the larger cropped version, and the second time with the cropped thumbnail.

Wondering if this would be a method that should work, where the repeater is referenced twice.

Monty Lewis

Monty Lewis 2 points

  • 4 years ago

The Diagnostics...

Perch: 3.0.8
Production mode: Production (100)
Installed apps: content (3.0.8), assets (3.0.8), categories (3.0.8), perch_blog (5.5.1), perch_events (1.9.5), perch_forms (1.9), perch_gallery (2.8.9), chirp_seo (1), perch_mailchimp (3.1), perch_twitter (3.7)
DB driver: PDO
DB tables: perch2_blog_authors (2), perch2_blog_comments (0), perch2_blog_index (948), perch2_blog_posts (30), perch2_blog_posts_to_tags (44), perch2_blog_sections (1), perch2_blog_tags (30), perch2_blogs (1), perch2_categories (8), perch2_category_counts (1), perch2_category_sets (2), perch2_chirp_seo (2), perch2_content_index (2589), perch2_content_items (300), perch2_content_regions (22), perch2_events (0), perch2_events_categories (0), perch2_events_to_categories (0), perch2_forms (0), perch2_forms_responses (0), perch2_gallery_albums (0), perch2_gallery_image_versions (0), perch2_gallery_images (0), perch2_menu_items (15), perch2_navigation (0), perch2_navigation_pages (0), perch2_page_templates (9), perch2_pages (11), perch2_resource_log (1494), perch2_resource_tags (35), perch2_resources (999), perch2_resources_to_tags (2406), perch2_settings (38), perch2_twitter_scheduled_tweets (0), perch2_twitter_settings (1), perch2_twitter_tweets (0), perch2_user_passwords (0), perch2_user_privileges (44), perch2_user_role_privileges (16), perch2_user_roles (2), perch2_users (1)
Users: 1
App runtimes:
<?php
    $apps_list = array(
        'perch_blog',
        'perch_gallery',
        'perch_forms',
        'perch_twitter',
        'perch_events',
        'perch_mailchimp'
    );
Scheduled tasks for perch_blog: delete_spam_comments (1440 mins)
Scheduled tasks for perch_mailchimp: import_data (1 mins)
Scheduled tasks for perch_twitter: post_tweets (1 mins)
Editor plug-ins: ace, ckeditor, markitup, redactor, tinymce
H1: 421aa90e079fa326b6494f812ad13e79
L1: 0ca7345c5f334a2bab54479e4e84ed92
F1: 0c66c2e1f82f9e0b7617b2cb8270f2c7
headerColour: #ffffff
content_singlePageEdit: 1
helpURL:
hideBranding: 1
content_collapseList: 1
lang: en-gb
update_2.8.32: done
latest_version:
on_sale_version:
update_3.0.1: done
perch_gallery_update: 2.8.5
perch_twitter_update: 3.5
perch_blog_update: 5.0.1
perch_blog_post_url: /post.php?s={postSlug}
headerScheme: light
perch_blog_site_name: Essex River Cruises
perch_blog_slug_format: %Y-%m-%d-{postTitle}
perch_blog_akismet_key:
perch_blog_max_spam_days: 0
perch_events_detail_url: /events/event.php?s={eventSlug}
perch_gallery_bucket_mode: single
perch_gallery_bucket: default
perch_mailchimp_api_key:
perch_mailchimp_campaign_url: /mailchimp/campaign/{campaignSlug}
dashboard: 0
hide_pwd_reset: 0
content_hideNonEditableRegions: 0
content_frontend_edit: 1
perch_blog_comment_notify: 0
perch_gallery_basicUpload: 0
logoPath: /perch/resources/logo.png
update_3.0.2: done
update_3.0.8: done
keyboardShortcuts: 1
content_skip_region_list: 0
perch_events_update: 1.8
siteURL: /
PERCH_DEVELOPMENT: 10
PERCH_STAGING: 50
PERCH_PRODUCTION: 100
PERCH_DB_USERNAME: root
PERCH_DB_SERVER: db_1
PERCH_DB_DATABASE: db_essexriverdb
PERCH_DB_PREFIX: perch2_
PERCH_TZ: America/New_York
PERCH_EMAIL_FROM: mlewis@lewisarts.com
PERCH_EMAIL_FROM_NAME: Monty Lewis
PERCH_LOGINPATH: /perch
PERCH_PATH: /var/www/html/perch
PERCH_CORE: /var/www/html/perch/core
PERCH_RESFILEPATH: /var/www/html/perch/resources
PERCH_RESPATH: /perch/resources
PERCH_HTML5: 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: 5163d57ff611b3cf853b
PERCH_DEBUG:
PERCH_PREVIEW_ARG: preview
PERCH_TEMPLATE_PATH: /var/www/html/perch/templates
PERCH_TEMPLATE_FILTERS:
PERCH_DEFAULT_DOC: index.php
PERCH_DEFAULT_EXT: .php
PERCH_PRODUCTION_MODE: 100
PERCH_XHTML_MARKUP:
PERCH_RWD: 1
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_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.1.0
Zend: 3.1.0-dev
OS: Linux
SAPI: apache2handler
Safe mode: not detected
MySQL client: mysqlnd 5.0.12-dev - 20150407 - $Id: d8daadaf41e3cd81d7c6ae96c6091fd15b2c9382 $
MySQL server: 5.7.17
Free disk space: 173.98 GB
Extensions: Core, date, libxml, openssl, pcre, sqlite3, zlib, ctype, curl, dom, fileinfo, filter, ftp, hash, iconv, json, mbstring, SPL, PDO, bz2, posix, Reflection, session, SimpleXML, pdo_sqlite, standard, tokenizer, xml, xmlreader, xmlwriter, mysqlnd, apache2handler, apcu, bcmath, Phar, exif, gd, gettext, mcrypt, mysqli, pdo_mysql, shmop, sockets, sysvmsg, sysvsem, sysvshm, zip, memcached, Zend OPcache
GD: Yes
ImageMagick: No
PHP max upload size: 12M
PHP max form post size: 8M
PHP memory limit: 128M
Total max uploadable file size: 8M
Resource folder writeable: Yes
Session timeout: 24 minutes
Native JSON: Yes
Filter functions: Yes
Transliteration functions: No
HTTP_HOST: localhost
HTTP_COOKIE: PHPSESSID=5ab173cb04d7fefc149b5836dd248f72; cmsa=1; gs_u_GSN-572831-M=49af39f7ab9e103007be97726e3dad44:2567:5000:1497472456693; gs_v_GSN-572831-M=; _ga=GA1.1.1624099262.1486573013; gs_u_GSN-907453-P=5fadddbabfafe7351b50f8fd84d72376:3663:6137:1488717837747; gs_v_GSN-907453-P=; gs_u_GSN-060044-T=e2d64ddce2e4a3d7db913ddf58300ed4:2567:5379:1486574533554; gs_v_GSN-060044-T=; addevent_track_cookie=f0afb55a-f598-4341-f556-5738f945d635
HTTP_CONNECTION: keep-alive
HTTP_UPGRADE_INSECURE_REQUESTS: 1
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/603.3.3 (KHTML, like Gecko) Version/10.1.2 Safari/603.3.3
HTTP_REFERER: https://localhost/perch/core/settings/diagnostics/
HTTP_ACCEPT_LANGUAGE: en-us
HTTP_ACCEPT_ENCODING: gzip, deflate
PATH: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
SERVER_SIGNATURE: <address>Apache/2.4.10 (Debian) Server at localhost Port 80</address>
SERVER_SOFTWARE: Apache/2.4.10 (Debian)
SERVER_NAME: localhost
SERVER_ADDR: 172.27.0.3
SERVER_PORT: 80
REMOTE_ADDR: 172.27.0.1
DOCUMENT_ROOT: /var/www/html
REQUEST_SCHEME: http
CONTEXT_DOCUMENT_ROOT: /var/www/html
SERVER_ADMIN: webmaster@localhost
SCRIPT_FILENAME: /var/www/html/perch/core/settings/diagnostics/index.php
REMOTE_PORT: 60924
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: 1498083213.828
REQUEST_TIME: 1498083213
argc: 1
Drew McLellan

Drew McLellan 2638 points
Perch Support

In theory the second instance of the repeater will not be taken into account when editing.

In reality, it's the other that's happening...

So I should handle this differently, right? not a bug?

Drew McLellan

Drew McLellan 2638 points
Perch Support

If your template is complex it might be best to have a simplified version as the master, and a more complex one for display.

Got it. Have an edit template with just the image calls in a repeater and then a display block with two instances of the repeater and I'm all set! Thanks!