Re: [jgen] Thumbnail/image issue

17 views
Skip to first unread message

Maciek Wołpiuk

unread,
Feb 1, 2024, 12:29:59 PMFeb 1
to joomla-de...@googlegroups.com
Hello

First try to change this line
if ($image->id == $deal->image_id)
to
if ((int) $image->id == (int) $deal->image_id)
cause in this dump image_id is string type

Pozdr
Maciek


Nie zawiera wirusów.www.avast.com

czw., 1 lut 2024 o 15:26 Lena <papa...@gmail.com> napisał(a):
if (count($deals))
{
$imageModel = JModelLegacy::getInstance('Images', 'CMLiveDealModel');

foreach ($deals as &$deal)
{
$images = $imageModel->getImages($deal->id);


foreach ($images as $image)
{
if ($image->id == $deal->image_id)
{
$deal->thumbnail = $image->file_path;
}
}
}
}


I have this code, the rest of them is working fine but I'm unable to see the image/thumb. Any idea why it's not working?

This is the "dump"

array(5) { [0]=> object(stdClass)#1259 (13) { ["id"]=> int(5) ["alias"]=> string(44) "only-a-quid-me-old-mucker-squiffy-tomfoolery" ["title"]=> string(44) "Only a quid me old mucker squiffy tomfoolery" ["user_id"]=> int(695) ["discount_info"]=> string(6) "prices" ["original_price"]=> string(5) "80.00" ["fixed_value"]=> string(4) "0.00" ["fixed_percent"]=> int(0) ["image_id"]=> string(1) "1" ["starting_time"]=> string(19) "2024-01-30 13:38:30" ["ending_time"]=> string(19) "2024-02-29 13:38:32" ["latitude"]=> float(51.50986499999999779220161144621670246124267578125) ["longitude"]=> float(-0.1180920000000000025242030687877559103071689605712890625) }

--
You received this message because you are subscribed to the Google Groups "Joomla! General Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to joomla-dev-gene...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/joomla-dev-general/3fa189b2-cb75-459b-816f-2ff93ad8346dn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages