Module: Image Block

daholzer

Joined: 2013-05-17
Posts: 18
Posted: Thu, 2013-05-30 02:44

When displaying Random Image in the sidebar the url it produces looks like this:

domain.com/image_block/random/33

and then redirect to the picture page. I've seen a bunch of other Gallery 3 sites that link directly to the image page and I would rather skip the redirect if possible. Can someone tell he how to accomplish this? Ive looked around all day and can't find any answers.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2013-05-30 03:28

Perhaps it is not the image block module. Carousel would be a example.
Got a URL to show the behavior that you said you have seen?

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
daholzer

Joined: 2013-05-17
Posts: 18
Posted: Thu, 2013-05-30 03:44

Its listed as "Image Block 3 Display a random image in the sidebar"

My site isn't live yet but here is an example from the very first site posted in http://galleryproject.org/gallery/g3demosites/

http://www.arabaresimleri2.com/

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2013-05-30 05:27

Looking at the source of the page you referenced I see:

<div id="g-image-block" class="g-block">
  <h2>Karışık Resimler</h2>
  <div class="g-block-content">
    <div class="g-image-block">
  <a href="/index.php/image_block/random/67">

So I still don't see what you are saying.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
daholzer

Joined: 2013-05-17
Posts: 18
Posted: Thu, 2013-05-30 05:54

The url of the picture link in the image block should be http://domain.com/album-name/picture-name but instead shows up as http://domain.com/image_block/random/21 and then redirects you to http://domain.com/album-name/picture-name

If you hover your mouse over the picture in random image in the sidebar at http://www.natureplanet.info/ it shows up as:

http://www.natureplanet.info/Fragrant-and-elegant-lilac-flowers-pictures/Fragrant-and-elegant-lilac-flowers-pictures-08

If you hover your mouse over the picture in random image in the sidebar at the site I showed you earlier http://www.arabaresimleri2.com it shows up as:

http://www.arabaresimleri2.com/index.php/image_block/random/368

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2013-05-30 06:32

I don't think that is the stock image block module. Could be the image block ex module.
The page you reference has a text-align attribute for the div.

<div id="g-image-block" class="g-block">
  <h2>Random image</h2>
  <div class="g-block-content">
    <div class="g-image-block" style="text-align:center">

And the image block module does not:
https://github.com/gallery/gallery3/blob/master/modules/image_block/views/image_block_block.html.php

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
daholzer

Joined: 2013-05-17
Posts: 18
Posted: Thu, 2013-05-30 07:02

Every single g3 site on the G3 demo page http://galleryproject.org/gallery/g3demosites/ works properly except the first site listed, which is the one I just showed you. It's not a different module. They are all Image Block with the just alignment added to center the picture. Thanks for trying to help me.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2013-05-30 15:07

Here is an example from page 14 of the demo sites:
http://seds.org/gallery/
it has the image_block/random/## for the url so I suspect they others have edited the default image module or it is a different module based on the image block module.

It should not be that hard to make the behavior they way you desire. How is your coding skills?

Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Thu, 2013-05-30 15:11

its a easy fix:
find
<a href="<?= url::site("image_block/random/" . $item->id); ?>">
and change to:
<a href="<?= $item->abs_url() ?>">

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
daholzer

Joined: 2013-05-17
Posts: 18
Posted: Thu, 2013-05-30 18:56

Thanks Dave!

That did the trick! I appreciate you taking the time to help me with this small problem. Is there an easy way to chose what pages Image Block shows up on? I basically want it on every page except the single photo pages.

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2013-05-31 03:04

eidt image_block_block.php Change

    return $block;

to

    // Only show the block on collection pages
    if ($theme->page_type == "collection") {
      return $block;
    }

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
daholzer

Joined: 2013-05-17
Posts: 18
Posted: Fri, 2013-05-31 06:10

You deserve a medal Dave, thanks!