PDA

View Full Version : Thumbnail Viewer II and PHP



papaver
10-01-2012, 04:31 PM
1) Script Title: Image Thumbnail Viewer II

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex4/thumbnail2.htm

3) Describe problem:
Hello,
I have integrated the thumbnailviewer2 into the wordpress loop, but it didn’t work.


<?php $image = get_post_meta($post->ID, 'image_medium', true);
if ( $image != '' ) {?>
<a href="<?php the_post_thumbnail($image, 'category-large-thumb' ); ?>" rel="enlargeimage" rev="targetdiv:loadarea,trigger:mouseover"><?php echo wp_get_attachment_image($image, 'category-small-thumb'); ?></a>
<?php } ?>

<div id="loadarea" style="width: 600px"></div>


The small thumbnail (<?php echo wp_get_attachment_image($image, 'category-small-thumb'); ?>) are shown, but when I hover I see only
“Loading Large Image” and a small white borderd box
(I have integrated the thumbnailviewer2.js version from
http://www.dynamicdrive.com/forums/showthread.php?62492-Thumbnail-Viewer-II-locks-up-if-file-not-found&highlight=thumbnail+viewer+II )

but no large Image.

Images are shown, when I set the “direct” pathway - it works perfectly


<a class="fancybox" href="<?php bloginfo('template_directory');?>/2_b.jpg" rel="enlargeimage" rev="targetdiv:loadarea,trigger:mouseover"><img src="<?php bloginfo('template_directory');?>/2_s.jpg" /></a>

<div id="loadarea" style="width: 600px"></div>



What can I do to show the large images in the loadarea.
Probably the .js has change, but I don't know how ...
I hope somebody have an idea - the Thumbviewer2 is already what I’m searching for.

Thanks
Petra

jscheuer1
10-01-2012, 05:05 PM
I think it's the PHP. Look at the browser's 'view source'. There you will see what the link's served source code is, particularly its href. It's probably to the wrong path or an error message, etc. It may even be correct but the HTML quoting convention might be off.

You should be able to use the default script as long as you're writing out via PHP the syntax it requires.

If you want more help, please include a link to the page on your site that contains the problematic code so we can check it out.

papaver
10-01-2012, 07:10 PM
Many thanks John, that you response so quickly.
You are right – the href-tag is empty, which include php-code.
I have no idea what you mean with “HTML quoting convention might be off ”

And here is the link to the Homepage
http://hirt-web-design-4u.de/?arbeit=malerei-test6

Thanks
Petra

jscheuer1
10-01-2012, 07:35 PM
The quoting conventions were just a possibility. Looks like the quotes are fine, there's just nothing in them. I cannot of course see the PHP code. You put this in your post:



<?php $image = get_post_meta($post->ID, 'image_medium', true);
if ( $image != '' ) {?>
<a href="<?php the_post_thumbnail($image, 'category-large-thumb' ); ?>" rel="enlargeimage" rev="targetdiv:loadarea,trigger:mouseover"><?php echo wp_get_attachment_image($image, 'category-small-thumb'); ?></a>
<?php } ?>

<div id="loadarea" style="width: 600px"></div>

If that's what you have, then:


<?php the_post_thumbnail($image, 'category-large-thumb' ); ?>

isn't returning anything. I'd try:


<?php echo the_post_thumbnail($image, 'category-large-thumb' ); ?>

or possibly (since it works with the small thumbnail):


<?php echo wp_get_attachment_image($image, 'category-large-thumb'); ?>

I'm not real up on PHP, but it makes sense that you would have to echo or use one of the other PHP commands that outputs text in order to get anything onto the page.

papaver
10-01-2012, 08:47 PM
Oh, I understand, you mean alternating single and double Quotes.
Yes, the idea is nice – to change the wordpress-php-terms, but it didn’t work.

Is it correct, that the thumbnailviewer2 run with an old jquery version (1.4.2). I tried the latest jquery version, but it didn’t run?

thanks
petra