Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - bernd

Pages: [1] 2 3 4 5 ... 11
1
Chit Chat / Show off my updated site (based on 1.7.9)
« on: March 05, 2011, 03:32:56 PM »
Hi all,

I wanted to share my updated site with you. It's been 5 years since the last update and I had silently hoped that 4images v.2 would surface in the meantime. As we all know, it didn't and so I took the plunge and built it on 1.7.9. The template is based on YAML and even though I started with the goal to change as little as possible in the 4images core, it ended up being quite a bit. There is still some work to be done to clean up the code and to fix a few quick hacks to make them work properly in all cases. And the search is something I'm not totally happy with. Overall, I'm pretty satisfied with the result though.

Let me know what you think - oh, it's only available in German, I'm afraid  :oops:

http://www.bildagentur-hamburg.com/hh

Let me know what you think.

regards,
b.

2
Programming / Re: How to use Facebook Open Graph Protocol
« on: March 02, 2011, 08:48:55 PM »
I can't access your site. AFAIK if you use the FBXML (or whatever the facebook freaks call their crap) like button and don't provide any URL it does take the current URL, doesn't it?

This PHP code would give you your current URL though:
$url "http" . ((!empty($_SERVER['HTTPS'])) ? "s" "") . "://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];

And you can play around with that. I did a dirty hack using this as a basis in the functions.php to provide me with an absolute path to the thumbnail image which I include in the og:image meta tag.

3
The best solution would be add the mode into user_loginform.html template.
Thanks but nope, does not have any effect. "mode" is in the "HTTP_REFERER" but gets removed by the regex. Adding it to the form does not change anything - it would require further changes to add $mode again to the URL the user is redirected to after logging in. So unless there is a good reason not to do what I did, I'll keep it like this.

cheers,
b.

4
OK, I found it. But I'm not sure if this is really a solution or if I mess something else up.

In global.php find this
$url preg_replace(array("/[?|&]action=[^?|&]*/""/[?|&]mode=[^?|&]*/""/[?|&]".URL_ID."=[^?|&]*/""/[?|&]l=[^?|&]*/""/[&?]+$/"), array(""""""""""), $url);

and replace with this
$url preg_replace(array("/[?|&]action=[^?|&]*/""/[?|&]".URL_ID."=[^?|&]*/""/[?|&]l=[^?|&]*/""/[&?]+$/"), array(""""""""), $url);

As you easily spot the "action", "mode" and a few other things are removed with this regex. I assume that there was a reason for doing so but I don't what it might be. Anyone have an idea?

cheers,
b.

5
yeah, it slows down the site. On my (weak) test system all queries are quicker than 0.044 sec, this one takes 3.3 sec :(
I am no SQL wizard so I don't really know how to make it quicker (if at all possible) but this one "only" takes 2.8 sec (and I hope it does the same):
Code: [Select]
SELECT COUNT(c.word_id) AS quantity, i.word_
FROM 4images_wordmatch c, 4images_wordlist i
WHERE keys_match > 0 and i.word_id = c.word_id
GROUP BY c.word_id
ORDER BY  RAND()
LIMIT 20

To use it I'm thinking about putting it into a separate file and loading it via ajax after the rest of the page has loaded.

6
sorry to bump this but does no-one have a clue?

7
The graphic-version works fantastic, BUT...
...instead of the graphic-buttons I do only use text-buttons in the functions.php:
[..]
The difference is just the background-color, which is given by the css-class "button" / "button_active".

I had the same "issue" and here I how I did it. I actually ended up doing it all in jQuery as I use on the site anyway. So there you go. my button code in functions.php looks like this

$lightbox_button "<div class=\"lightbox\"><a href=\"".$site_sess->url($lightbox_url)."\" id=\"img".$image_row['image_id']."\" class=\"icon-tip\" title=\"".$lang['alt_lightbox_no']."\">".$lang['lightbox']."</a></div>";

and

$lightbox_button "<div class=\"lightbox\"><a href=\"".$site_sess->url($lightbox_url)."\" id=\"img".$image_row['image_id']."\" class=\"icon-tip\" title=\"".$lang['alt_lightbox_yes']."\">".$lang['lightbox']."</a></div>";

This is slightly different from the standard set-up but you'll be able to spot the differences. I put the image-ID concatenated with "img" inside the id attribute as I will use jQuery to change this element's title attribute later on and finding this element I could only get to work using the id. Putting the "img" in front of the id itself is because an id should not start with a number. This lightbox link works as is also without jQuery.
This is the jQuery code (mine actually is slightly different as I also toggle a parent's <li> class)

Code: [Select]
$(document).ready(function() {
$('li div.lightbox a').click(function() {
var elementId = '#'+$(this).attr('id');
$.get(
"lightboxaction.php",
{ id: $(this).attr('id') },
function(data) {
$(elementId).attr('title', data);
},
"text");
return false;
});
});

I put this code into the footer.html. And then of course my lightboxaction.php

<?php
define
('ROOT_PATH''./');
include(
ROOT_PATH.'global.php');
require(
ROOT_PATH.'includes/sessions.php');
$error 0;
if (isset(
$HTTP_GET_VARS['id']) || isset($HTTP_POST_VARS['id']))
{
  
$id = (isset($HTTP_POST_VARS['id'])) ? substr(trim($HTTP_POST_VARS['id']), 3) : substr(trim($HTTP_GET_VARS['id']), 3);
}
else
{
  
$id "";
}
if (
$id)
{
  if (
check_lightbox($id))
  {
    
$title = (remove_from_lightbox($id)) ? $lang['alt_lightbox_no'] : $lang['alt_lightbox_yes'];
  }
  else
  {
    
$title = (add_to_lightbox($id)) ? $lang['alt_lightbox_yes'] : $lang['alt_lightbox_no'];
  }
}
else
{
  
$error 1;
}
if (
$error)
{
  die(
"Security violation");
}
echo 
$title;
?>


So to the previous question, it would be very easy to adopt it. Just change the jQuery code to the following. This should work and toggle your two classes on and off.

Code: [Select]
$(document).ready(function() {
$('li div.lightbox a').click(function() {
var elementId = '#'+$(this).attr('id');
$.get(
"lightboxaction.php",
{ id: $(this).attr('id') },
function(data) {
$(elementId).attr('title', data);
},
"text");
$(this).toggleClass('button');
$(this).toggleClass('button_active');
return false;
});
});

Oh - and of course you guys need to adopt the jQuery selector for the "click" to your needs. So the
Code: [Select]
$('li div.lightbox a').click(function() {needs to match your document's structure.

Yes, I agree - this is not a nice copy+paste tutorial but it should allow you to adopt it to your needs if you know a bit jQuery. I mean, I managd to come up with this and I hardly know jQuery  8)

b.

8
4images 1.7.9 - I'm on the details.php via a search result, hence the URL ends with &mode=search. If I now log in (or out) the details.php is reloaded but without the &mode=search.
The same actually happens when you vote for an image that you reached via a search result. I found an ancient post by V@no but that was only for the vote preblem, not for the log in/out issue.

Does anyone have an idea what needs to be changed where to keep the &mode=search when logging in or out?

If you want to test it go to the 4images demo and try it for yourself:
http://demo.4homepages.de/details.php?image_id=54&mode=search&l=english and then vote for the image.

thnx,
b.

9
There is something strange going on on your site with this mod...the reason its showing broken image is because it send thum_id instead of id. I don't know what else you've changed in the code, but I suggest you reinstall this mod.
Yeah - true. I did enhance it as I use different "Lightbox" image for the thumbnail view. What stroke me is that it did work on the old server.

And now tadaaaa I fixed it (sorry, no Voodoo). Apparently the old server had "register_globals" activated, the new one does not and I did not use $_GET['thumb_id'] but directly $thumb_id ... changed, now it works.

Sorry for the trouble but thanks a bunch for the code update V@no it's appreciated!

cheers,
bernd

10
I have a weird problem and I can't seem to be able to get my head around it:

I moved servers, on the old server everything was working perfectly. Now on the new server this MOD works on the detail page flawlessly but on the thumbnail view (either category, lightbox or search result) it doesn't. When I click on the lightbox button it "replaces" the image with a broken image and the image is not added/removed from the lightbox.
I didn't change a think in the configuration and all images are where they are supposed to be. Anyone had that before? Any idea what to look for?
I checked with Firebug / JavaScript console but no errors popped up.

If you want to take a look yourself go to http://www.bildagentur-hamburg.com/hh/  you will need to be registered though.

Any feedback would be appreciated!

cheers,
Bernd

11
This is not too bad but how about making it display how many search results the user can expect when submitting the searchform? I mean I start to type "tre" and it shows me that there is a keyword used named "tree" - nice but I have to submit the search first before I know how many hits I achieve. If I were to see that searching for "tree" would provide me with 1000 images but if I searched for "tree winter" it would only be 10, that would be helpful. So more like Google suggest (still not quite but better :) )
http://www.google.com/webhp?complete=1&hl=en

Any ideas?

cheers,
Bernd

12
thnx V@no - this put me in the right direction. It's not too bad to implement I think. I already have the category view limited and can show the ID of the main image in the details. So I now need to get the "related images" display in the details for the main image and have an indication in the thumbnail view that this actually is not a single image but belongs to a stack. Any idea how implement that elegantly? I was thinking to query the DB for each image
Code: [Select]
$sql = " SELECT *
FROM " . IMAGES_TABLE . "
WHERE image_related=" . $image_id;
If there is a result that'd mean that the main image has related images and I could show it with a coloured border for instance. But I am a little anxious that this would have quite an impact on the performance when I have a few dozen images in thumbnail view this'd mean a few dozen SQL queries. Does anyone have a better/different idea?

I'll keep you posted on my progress.

cheers,
bernd

13
I understand your request, but without heavy modifications it would be easy to do by just creating sub categories for those images...
hmm, yeah - no :-)
me no like sub categories for that ;)
The biggest drawback is that this won't help the search results - still all images would show up. Maybe someone else has a better idea ... or I need to find an intern to pick his brain and have him do the heavy mod :-D

cheers,
Bernd

14
Hi,

ever so often I end up with a bunch of images that are almost the same - sort of belong to each other but ditching some of them won't be right either. But having a dozen images in a category is not nice for the user either. So what I'd like to have is to "stack" these images together, only showing one in the category (or the search result), giving an indication that this is actually a stack by an icon or some other visual treat. When the user then opens this stack he/she sees the image plus all other images that belong to this stack.

If you've worked with Adobe Bridge or Lightroom or Apple Aperture you know what I'm referring to. The Adobe help site has a nice visualization of what I'm trying to discribe http://livedocs.adobe.com/en_US/Bridge/2.0/help.html?content=WS0FED4788-09A5-45f5-B136-BEFE64ADE5F6.html and there is also a video on youtube http://www.youtube.com/watch?v=A-X1zDt6nkc&feature=related where a guy explains the stacks in Lightroom.

So - does anyone think that this is a possible modification? I'm trying to think myself but haven't found the "entrance" yet.

Thanks for reading,
bernd

15
That leaves me with the need for a customisation to lightbox to let the user notify me what's in their lightbox / what they want to order.
So you are looking for this http://www.4homepages.de/forum/index.php?topic=3102.0 ?

Pages: [1] 2 3 4 5 ... 11
Post your comments here