Get number of values from image field without rendering it

More
9 years 5 months ago - 9 years 5 months ago #55108 by ChobPT
Hello!

I'm building a real estate property and my category page shows the item with blocks like the one in the attachment:



I have been using a way to cound the images and floorplans that actually works by just counting the number of values the field has, but this means that the whole field needs to be loaded, making the page to loads so much slower (2min instead of 10secs).

I was wondering if somebody would have a simple way to count how many values a field has without actually rendering it.

Thanks in advance
Last edit: 9 years 5 months ago by ggppdk.

Please Log in or Create an account to join the conversation.

More
9 years 5 months ago - 9 years 5 months ago #55112 by ggppdk
Hello

you can use:
$imgfield_id = 57;
$_count = ! isset( $item->fieldvalues[$imgfield_id] ) ? 0 : count($item->fieldvalues[$imgfield_id]);

but NOTE:
-- the first time the image field runs in a category view that you have change thumbnails size, it will take long
on subsequent runs it checks if images exist and also checks the file sizes

-- v3 BETA7* is optimized for filtering large views

-- in your case the 10 seconds that you mention, i am guessing that you are display many items per page ??
that is not possible unless, you have 100+ or 200+ items per page ??
component times should be <1 second for 10 items per page, even if view has 10,000 items


since you are making a new website

please send me a PM with admin access,

to see site performance of v3 BETA7*, it is stable and has optimizing filtering very large views (e.g. filtering 10,000 items per view)


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...
Last edit: 9 years 5 months ago by ggppdk.

Please Log in or Create an account to join the conversation.

More
9 years 5 months ago #55114 by ChobPT
Wow, thanks a lot for the quick response.

It also worked without compromising the speed, thanks a lot!

Basically the customer would like that when he is logged in there is no pagination, and since the platform has 600 imported items, it was loading all the images (even though the $field->display; wasn't set for that field), taking a lot of time.

Now this is the performance:

Page load time: 9.24s
Total page size: 2.08MB
Total number of requests: 119

With items per page = 1000 (but showing only 222 pulished items), caching is off

Again, thanks a lot :)

Please Log in or Create an account to join the conversation.

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.843 seconds
Save
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline