Overview
Property images are stored in theimages array within the property object. Each image object contains metadata about the image file, display order, and optional descriptive information.
Image Object Structure
Image filename or URLThe application prepends
images/ to relative paths unless the URL starts with http.Example: "venta-594a5fafcf-1.webp"Display order of the image (1-based)Images are sorted by this field in ascending order before rendering.Example:
1, 2, 3Image type identifierUsed to categorize images (e.g., interior, exterior, amenities).Example:
1Optional image titleTypically
null in the current implementation.Example: null or "Living Room View"Optional image comment or descriptionTypically
null in the current implementation.Example: null or "View from balcony"Example Image Array
Image Processing & Rendering
Normalization
Images are processed in thenormalizeProperty() function (app.js:574-579):
- Array validation: Ensures
imagesis an array - Sorting: Images are sorted by
orderfield (ascending) - URL extraction: Maps objects to their
urlproperty - Fallback: Returns empty array if images are invalid
URL Resolution
Image URLs are resolved inrenderGallery() (app.js:247-249):
- Absolute URLs: URLs starting with
httpare used as-is - Relative URLs: Prepended with
images/directory - Missing images: Placeholder image is shown when array is empty
Gallery Display
Images are rendered in three locations:-
Main Gallery (
app.js:237-392)- Large preview image
- Thumbnail strip with pagination (4 on mobile, 8 on desktop)
- Navigation arrows for main image
- Click to open lightbox
-
Lightbox (
app.js:54-212)- Full-screen image viewer
- Thumbnail navigation (8 per page)
- Keyboard navigation (Arrow keys, Escape)
- Image counter (e.g., “3 / 15”)
-
360° Tour Button
- Displayed on first image only when
url_360exists - Visibility controlled by
index === 0check
- Displayed on first image only when
Sorting Behavior
Theorder field determines display sequence:
- Images without an
orderfield default to0 - Ascending numeric sort
- Maintains original order for equal values
Image Count Display
The photo count is displayed in the gallery header (app.js:256-259):
Responsive Behavior
Thumbnail pagination adjusts based on screen size:- Mobile (less than 768px): 4 thumbnails per page
- Desktop (768px and above): 8 thumbnails per page
- Window resize triggers thumbnail re-render
Common Patterns
Checking for Images
Opening Lightbox at Specific Image
Double-Click to Zoom
Related Components
- Property Schema - Parent property object
- Gallery component -
renderGallery()inapp.js:237 - Lightbox component -
initLightbox()inapp.js:183