Okay, I've spent two hours hunting around this new install, trying to find out how to get images displayed. I can't fathom how it's supposed to work.

I ran the drush import, duly downloaded listings, populated the database. Images all got processed and put into the drealty_image subfolder.

When no images appeared in the /listing/#MLS pages I went hunting through the module to try and find out how it's supposed to work.

I see custom views code for processing it. I created a view and tried adding MLS images field to it, but that does not work.

I've dug around inside the module code (nice coding, btw! - really nice to see some oo php again) and the db structure and I can't figure out how the listings table is possibly supposed to key to the file_managed table, which is as far as I got.

I give up. HOW do I get my property listing images to show?

Thanks

Comments

ptoly’s picture

bump. any help?

camidoo’s picture

they should appear in the ->mls_images member of the entity, additionally in the content array you "should" be able to do in a template render($content['mls_images']); and see them that way.

in drealty.module under the DrealtyListingController::attachLoad function, it selects all the images from the file_usage table key'd off the entity->id && the type == drealty_listing

  public function attachLoad(&$queried_entities, $revision_id = FALSE) {
    parent::attachLoad($queried_entities, $revision_id);

    foreach ($queried_entities as $entity) {
      $fids = db_select('file_usage', 'f')
        ->fields('f', array('fid'))
        ->condition('id', $entity->id)
        ->condition('type', 'drealty_listing')
        ->execute()
        ->fetchAllAssoc('fid');
      if ($fids) {
        $fids = array_keys($fids);
        $files = file_load_multiple($fids);
        $entity->mls_images = $files;
      }
    }
  }

if the usages weren't added, then when it goes to select it won't select anything, so first thing i would check is the file_usage table and ensure that there are entries there.

if they're not being added, the usages that is, let me know and we can figure out why.

webavant’s picture

I have had the same experience with dRealty. I am new to entities, so I was surprised that no images appeared when viewing a listing's node. In addition to camidoo's suggestions, you may also be pleased to also see that the entities' image fields can be made available to views for a quick way to see that images are being properly downloaded.

ptoly’s picture

Thanks for the info, helped me a lot.
The file_useage entries are there and the images are downloaded.

However, it looks like the $element is malformed? (I'm still new at the D7 stuff).

Here's what I got from a dpr on the $content['mls_images']:

Array
(
    [#value] => Array
        (

            [290919] => stdClass Object
                (
                    [fid] => 290919
                    [uid] => 1
                    [filename] => 1125650-10.jpg
                    [uri] => public://drealty_image/1125650-10.jpg
                    [filemime] => image/jpeg
                    [filesize] => 12485
                    [status] => 1
                    [timestamp] => 1321733635
                    [origname] => 1125650-10.jpg
                )

[omitted the rest of the objects, for brevity]

        )

    [#markup] => <div><div class='field-label'><strong>mls_images</strong></div><div class='field-value'>Array</div></div>
)

I'm going on the hunch that the objects are not properly formed for the render function... still sleuthing...

@webavant - thanks! I'd already tried to use views. It also failed.

webavant’s picture

Confirmed, dpr on the $content['mls_images'] looks the same for me as well.

jrcholtz’s picture

same prob as above, what is the solution?

jrcholtz’s picture

jrcholtz’s picture

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 2635603 bytes) in /home/jrcholtz/public_html/includes/cache.inc on line 337
Drush command terminated abnormally due to an unrecoverable error. [error]
Error: Allowed memory size of 134217728 bytes exhausted (tried to
allocate 2635603 bytes) Is this a result of my PHP memory limits on Remote server, my limit is 128M do I need to upgrade to a VPS? is there a way around this? Anyone have a solution to how to get the images? this happens when I try to process the images.

webavant’s picture

I'm surprised it's using up all 128M. Upgrading to more memory seems like the simple solution, but perhaps there is an issue to be made here.

webavant’s picture

Also, jrcholtz, please open a new issue for this matter. This issue is for discussing theming and displaying images.

jrcholtz’s picture

camidoo’s picture

anyone get anywhere with the images?


foreach($mls_images as $image) {  
  print theme('image', array('path' => $image->uri, 'alt' => $listing->name));
}

not sure where the hang up is as i'm displaying images, and they're showing up in views for me as well...

kevinquillen’s picture

Status: Active » Closed (cannot reproduce)

I see images too. Since this was filed against a really old version and there has not been a response, I'll mark this as closed.

#8 - set the memory limit to 256M. That fixed the drush error for me.