chaitu111 / timthumb

Automatically exported from code.google.com/p/timthumb
0 stars 0 forks source link

failed attempt to execute timthumb from within another php file #317

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
ref link: http://www.thebeautifulbloghunt.com/explore/

i'm attempting to use timthumb in conjunction with a wordpress plugin called 
"image feed widget".
this plugin pulls images, titles + links from a list of rss feeds and outputs 
them in a ul. 

i've attached the single php file that executes this plugin.

i modified the following excerpt of code within this file to execute timthumb.

 <ul class="image-feed-list"><?php
        // Loop through each feed item and display each item as a hyperlink.
          foreach ( $rss_items as $item ) : ?>
            <li>
                      <div class="<?php echo $divname; ?>">
                          <a href="<?php echo $item->get_permalink(); ?>"
                    <?php if ($target == 'newwindow') { echo 'target="_BLANK" '; }; ?>
                    title="<?php echo $item->get_title().' - Postada em '.$item->get_date('d M Y, H:i'); ?>">
                            <?php if ($thumb = $item->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'thumbnail') ) {
                                $thumb = $thumb[0]['attribs']['']['url'];
                            echo '<img src="http://thebeautifulbloghunt.com/wp-content/themes/aci-the-beautiful-blog-hunt-theme/timthumb/timthumb.php?src='.$thumb.'&q=100&w=300&h=300"'; 
                                echo ' alt="'.$item->get_title().'"/>';
                             } else if ( $useenclosures == 'yes' && $enclosure = $item->get_enclosure() ) {
                                $enclosure = $item->get_enclosures();
                            echo '<img src="http://thebeautifulbloghunt.com/wp-content/themes/aci-the-beautiful-blog-hunt-theme/timthumb/timthumb.php?src='.$enclosure[0]->get_link().'&q=100&w=300&h=300"'; 
                                echo ' alt="'.$item->get_title().'"/>';
                            }  else {
                                preg_match_all('/<img[^>]+>/i',$item->get_content(), $images);
                                if ($images) {
                                  echo $images[0][0];
                                } else {
                                  echo "thumbnail not available";
                                }
                            } 
                            if ($printtext) {
                              if ($printtext != 'no') {
                                echo "<div class='imgtitle'>".$item->get_title()."</div>";
                              }
                            }?>
                          </a>
                      </div>
            </li>
          <?php endforeach; ?>
        </ul>

original code, prior to timthumb modification:

<ul class="image-feed-list"><?php
        // Loop through each feed item and display each item as a hyperlink.
          foreach ( $rss_items as $item ) : ?>
            <li>
                      <div class="<?php echo $divname; ?>">
                          <a href="<?php echo $item->get_permalink(); ?>"
                    <?php if ($target == 'newwindow') { echo 'target="_BLANK" '; }; ?>
                    title="<?php echo $item->get_title().' - Postada em '.$item->get_date('d M Y, H:i'); ?>">
                            <?php if ($thumb = $item->get_item_tags(SIMPLEPIE_NAMESPACE_MEDIARSS, 'thumbnail') ) {
                                $thumb = $thumb[0]['attribs']['']['url'];
                            echo '<img src="'.$thumb.'"'; 
                                echo ' alt="'.$item->get_title().'"/>';
                             } else if ( $useenclosures == 'yes' && $enclosure = $item->get_enclosure() ) {
                                $enclosure = $item->get_enclosures();
                            echo '<img src="'.$enclosure[0]->get_link().'"'; 
                                echo ' alt="'.$item->get_title().'"/>';
                            }  else {
                                preg_match_all('/<img[^>]+>/i',$item->get_content(), $images);
                                if ($images) {
                                  echo $images[0][0];
                                } else {
                                  echo "thumbnail not available";
                                }
                            } 
                            if ($printtext) {
                              if ($printtext != 'no') {
                                echo "<div class='imgtitle'>".$item->get_title()."</div>";
                              }
                            }?>
                          </a>
                      </div>
            </li>
          <?php endforeach; ?>
        </ul>

i have confirmed that timthumb is in the correct location where it is being 
called:
http://thebeautifulbloghunt.com/wp-content/themes/aci-the-beautiful-blog-hunt-th
eme/timthumb/timthumb.php

i have also manually added the websites that the images are called from to the 
timthumb allowed sites array. 

What is the expected output? What do you see instead?
the images are being displayed, but are showing as distorted or squished-they 
are not resized properly.
from viewing the source code, it appears as though the timthumb script is not 
being executed at all. there is no reference to it in the live site's source 
code.

What version of the product are you using? On what operating system?
timthumb 2. macbook pro os lion

Please provide any additional information below.
my php knowledge is somewhat limited so perhaps i am making a simple error. i 
tried moving things around but could not find the correct configuration on my 
own. any help would be greatly appreciated! thank you!

Original issue reported on code.google.com by lanitr...@gmail.com on 9 Jan 2012 at 9:10

Attachments:

GoogleCodeExporter commented 8 years ago
update: timthumb is executed from certain rss feeds but not others- but the 
image quality is terrible, even with q=100
attached is sample image

Original comment by lanitr...@gmail.com on 9 Jan 2012 at 10:50

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by BinaryMoon on 3 Dec 2012 at 7:59