need to apply an if/else statement to Tim Thumb script


Posted on 16th Feb 2014 07:03 pm by admin

Not sure how to work this. I essentially want to call a variety of image sizes based on which stylesheet a user chooses from the administration backend of a wordpress theme. The sizes of the images would be different depending on which stylesheet is selected. My idea is to write an if/else statement to accomplish this, but don't know how.

The script looks like this:

Code: <?php // This will show the image and link the image to the post. Alter the width and height (in both places) to your needs. ?>
<?php if ( get_post_meta($post->ID, 'thumb', true) ) { ?>
<div class="postthumb">
<a href="<?php the_permalink(); ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
<img src="<?php bloginfo('template_directory'); ?>/scripts/timthumb.php?src=<?php echo get_post_meta($post->ID, "thumb", $single = true); ?>&h=180&w=200&zc=1" alt="<?php the_title(); ?>" width="200" height="180" /></a>
</div>
<?php } ?>

If the user selects a layout utilizing a 200px wide image this script would work, but if they choose a layout using a 300px width image the Tim Thumb script would have to be obviously different.

Basically, I would like to offer a different Tim Thumb script based on whatever layout/stylesheet the user selects. And I think the best way is to offer an if/else statement, but I don't know how to do this...

Any help would be greatly appreciated...

No comments posted yet

Your Answer:

Login to answer
117 Like 32 Dislike
Previous forums Next forums
Other forums

Bluetooth RSSI & VIsta
Okie I got 4 Bluetooth adapters, a DBT-120 by Dlink, A Zonet Microsoft Bluetooth which is what I use

Display data returned from Ajaxservices!!
I have a question about displaying results using ajax. I have part of the code below.
$.ajax({

Text Not Displaying Correctly With PHP:GD
I recently moved servers and since then I have noticed that one line of text is showing weirdly.

email form (cannot find the problem)
Hello there. I've been having trouble with an email form. Can't find the problem really. I've tested

Add "width" check when upload
Hi!

Can someone add a function that is checking if picture witdh is bigger then 800px whwn up

ECC6 - Single sign-on
We are in the process of upgrading to ECC 6 which will support single sign on with user passwords al

Simple Variable Question
Hi everyone.... again,

I am really getting into php still. Learning more every day. I love it

Time-based image rotation script
I'm trying to write a PHP script that rotates an image based on what time of day it is. I want the

displaying email without attracting a ton of spam
Hello,

this is maybe the wrong place to ask.
How would you display an email address on a w

Production of mango in processing industry
Hi,

We have one scenario ,company is in process industry,they are manufacturing MANGO pul

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash