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...

Thanks!

No comments posted yet

Your Answer:

Login to answer
150 Like 54 Dislike
Previous forums Next forums
Other forums

Upload Code Help
Hi everyone I need some help with a bit of code ive been working with for a while. I am completely s

VAT
how should I deal with VAT?

if I have a product that costs £5.00 and VAT @ 17.5% (£0.87

Preserving user-entered linebreaks
Hi, I'm building a web 2.0 thingy from scratch and I wanna display text which users input. It's all

Please help understand this code
I noticed the index page on my site was modified this morning and found this code inserted at the bo

php multiple action on submit
I have a form which says:

<form enctype='multipart/form-data' method='post' action='pr

Protecting forms
Alright, I want to protect some forms of mine from SQL Injections, because I had someone earlier spa

PHP Code To Change Font Color in Table Cell
I would appreciate help with the following snippet of my php code. I am just trying to change the f

Session variable help
I'm having a very troubling issue. Maybe I'm just looking over something but I have looked at the co

Display search result
Hi!

I have a SQL database with information about albums and track (music).

This is wh

DELETE FROM not working deletes wrong row
Hello

I have the following code which i found but it doesnt work properly.. it comes up with

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