Can someone help me modify this PHP Script?

Discussion in 'HTML & Website Design' started by moronic_kaos, Feb 18, 2010.

  1. #1
    BEFORE READING: KEEP IN MIND THIS IS THE INDEX.PHP FILE OF A WORDPRESS BLOG THEME


    
    <?php
    	$customfields = get_post_custom();
    	$scrp = get_bloginfo('wpurl') . '/wp-content/themes/magasin-uno/functions/timthumb.php?';
    	if (empty($customfields['paddimage'][0])) {
    		$imgpath = $scrp . 'src=' . get_bloginfo('wpurl') . '/wp-content/themes/magasin-uno/images/thumbnail.png' . '&w=68&h=68&zc=1';
    	} else {
    		$imgpath = $scrp . 'src=' . get_bloginfo('wpurl') .  $customfields['paddimage'][0] . '&w=68&h=68&zc=1';
    	}
    ?>
    
    Code (markup):
    It calls for a PHP script called "timthumb", and adds whatever is in the "paddimage" field to it, which results in an image source address something like this:

    
    http://toothsurgery.info/wp-content/themes/magasin-uno/functions/timthumb.php?src=http://toothsurgery.info/wp-content/themes/magasin-uno/images/root%20canal%20thumb.jpg&w=68&h=68&zc=1
    
    Code (markup):
    I'm not exactly 100% sure how this code works (I'm only moderately fluent in PHP). What I'm trying to do is get around the whole timthumb script and get a url that consists of JUST the image from the "paddimage" field, no php file. How can I do that?
     
    moronic_kaos, Feb 18, 2010 IP
  2. ajmartin

    ajmartin Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    try this -

    
    <?php
    	$customfields = get_post_custom();
    	// $scrp = get_bloginfo('wpurl') . '/wp-content/themes/magasin-uno/functions/timthumb.php?';
    	// if (empty($customfields['paddimage'][0])) {
    	//	$imgpath = $scrp . 'src=' . get_bloginfo('wpurl') . '/wp-content/themes/magasin-uno/images/thumbnail.png' . '&w=68&h=68&zc=1';
    	// } else {
    		$imgpath = 'src=' . get_bloginfo('wpurl') .  $customfields['paddimage'][0] . '&w=68&h=68&zc=1';
    	// }
    ?>
    
    Code (markup):
    timthumb.php is a thumbnail resizer script - this originally reads as follows:

    grab a custom field
    find the resizer script
    if there is not a custom field called paddimage look for a fixed thumbnail image called thumbnail.png and then force the path to use the thumbnail resizer.

    I just commented out everything you dont need and removed the call to the timthumb in the path ($scrp) .

    hope that works for ya

    aj
     
    Last edited: Feb 18, 2010
    ajmartin, Feb 18, 2010 IP
  3. moronic_kaos

    moronic_kaos Well-Known Member

    Messages:
    202
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    110
    #3
    Thanks a lot
     
    moronic_kaos, Feb 18, 2010 IP
  4. ajmartin

    ajmartin Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    did that work? also do you do web graphics? I need custom headers done for WP sites. Nothing too fancy but need to be professional. No clip art.

    I do WP customization so I can likely help you with PHP and WP code customization.

    PM me your contact info if you are interested in working together
     
    Last edited: Feb 18, 2010
    ajmartin, Feb 18, 2010 IP