PWesterdale / KirbyGram

Instagram Plugin for Kirby CMS
22 stars 3 forks source link

KirbyGram causes blank page #3

Closed timnarr closed 9 years ago

timnarr commented 9 years ago

Hi @PWesterdale I want to use kirbygram, but got an blank page... only by copy the files to my plugin folder. The header responses with an "500 Internal Server Error".

PWesterdale commented 9 years ago

Hi Tim, When did you download kirbygram? Also can you let me know what version of PHP you are running?

timnarr commented 9 years ago

5 minutes ago and I'm using PHP 5.3

PWesterdale commented 9 years ago

Hi Tim,

There is currently an open issue for backporting to 5.3, I'll get it sorted out for you as soon as I can.

timnarr commented 9 years ago

If it only affects the php version then I can change it... KirbyGram should work with 5.4, right? Thank you for your quick help :-)

PWesterdale commented 9 years ago

It should be fine with 5.4, I'm just making some final changes to fix compat with 5.3 now, its up to you if you want to upgrade though :)

No Problems, any further questions just ask :)

PWesterdale commented 9 years ago

If you are able to test, There is an updated version available on the branch feature-backcompat:

https://github.com/PWesterdale/KirbyGram/tree/feature-backcompat

That should hopefully work in 5.3

timnarr commented 9 years ago

wow, you're on fire :-) jip, this works for me. no blank page, or errors so far

PWesterdale commented 9 years ago

Excellent, let me know when you are happy, and I'll close this out and get the repository up to date - Thanks for your help testing it :)

timnarr commented 9 years ago

hm, don't get it work. With my current code images aren't displayed.

<?php foreach($instagram->feed()->limit(6)->get() as $image): ?>
<img src="<?php echo $image->thumbnail() ?>" alt="" width="640" height="640" />
<?php endforeach ?>
PWesterdale commented 9 years ago

try putting

<?php $instagram = new Instagram(); ?>

above your foreach loop

PWesterdale commented 9 years ago

Did that fix your issue @TimGr?

timnarr commented 9 years ago

Thank you. Yes it works now :-)

I have noticed a few things. -caption() works fine -likes() outputs only "1" -tags() outputs only "array"

Is there a way to add a link to the image.. I mean not the src-link. Just a link to the image on the instagram page.

Thank you for your time!

PWesterdale commented 9 years ago

likes() is to output the amount of times the photo displayed has been liked on Instagram, has the photo been liked more than once? tags() is supposed to be an array, you can display the individual tags by doing a further foreach loop:

foreach($image->tags() as $tag){
   echo $tag;
}

You can retrieve the image url by using the following:

$image->raw()->link

I'll be adding that as a function in the future, but that will work for you now :)

timnarr commented 9 years ago

yes, one image has 45 likes, the next one 15 likes...

image url is working great now :)

<?php $instagram = new Instagram(); ?>
     <?php foreach($instagram->feed()->limit(6)->get() as $image): ?>
      <div class="item width-16 instagramimages">
            <a href="<?php echo $image->raw()->link ?>">
                  <img src="<?php echo $image->max() ?>" alt="" width="640" height="640" />
                  <div class="caption fade-caption">
                        <span><?php echo $image->likes() ?></span>
                  </div>
            </a>
      </div>
<?php endforeach ?>
PWesterdale commented 9 years ago

Tim can you send me a copy of your config.json file in the /plugins/kirbygram directory. Please send it to my e-mail address:

paul@westerdale.me

I can debug with your image set then.

timnarr commented 9 years ago

Is on the way :)

PWesterdale commented 9 years ago

Hey Tim,

If you grab an update version of the code, all should be well now.

timnarr commented 9 years ago

Yes! everything works fine now :-) Thank you very much, Paul. And again, thank you for taking the time!

PWesterdale commented 9 years ago

No Problem, thanks for helping me improve it :+1: