function render_hardcore() { ?> <h2 class="nav-tab-wrapper"> <a href="admin.php?page=uber-grid-image-troubleshooting-easy" class="nav-tab">Easy way using JetPack</a> <a href="admin.php?page=uber-grid-image-troubleshooting-hardcore" class="nav-tab nav-tab-active">Hardcore way</a> </h2> <section> <div> <h3>Alright, you want to control it.</h3> <p> If you are reading this page, then, probably, UberGrid images do not load with a default timthumb configuration. To resolve the issue, you'll need some technical experience, so if you are not a PHP coder, it is best to stick to <a href="admin.php?page=uber-grid-image-troubleshooting-easy">JetPack way</a>. </p> <h3>Short intro.</h3> <p>First things first. I highly recommend to read <a href="http://www.binarymoon.co.uk/2010/08/timthumb/" target="_blank"> Timthumb basics</a> to get an understanding how it all works. Basically, it just takes the image you reference by URL, downloads it (or reads from the disk), resizes / crops to dimensions you need, and stores in a cache directory. </p> <p>In other words, TimThumb needs the next things to work properly:</p> <ul> <li> <strong>PHP GD library installed.</strong> Most of PHP installation have it nowadays, but who knows. You can check if GD is installed on your web server at <a href="edit.php?post_type=uber-grid&page=support">UberGrid support page</a>. </li> <li> <strong>A writable cache folder</strong> located at <code>wp-content/uber-grid-cache</code> or <code>wp-content/uploads/uber-grid-cache</code>. </li> <li> <strong>It needs to find the file referenced.</strong> UberGrid needs to know the directory at which the images are stored. It is <code>wp-content/uploads</code> by default, but can be changed on some WordPress installations. </li> </ul> <ul> <li> Timthumb can't find the file hosted at your server because the URL structure does not match the file physical location. </li> <li>Timthumb can't create a cache directory.</li> </ul> </div> <div class="image-wrapper"> <img src="<?php echo UBERGRID_URL; ?> /assets/admin/images/image-troubleshooting/image-5-coding.jpg"> </div> </section> <section> <div> <h3>Quick diagnostics.</h3> <p> Let's try to feed some image to timthumb and see what happens. Ideally, you should see the same image you see next to this paragraph. <?php $src = wp_get_attachment_image_src(uber_grid_get_test_image(), 'original'); ?> </p> <a href="<?php echo uber_grid_get_timthumb_url($src[0], array('width' => 800, 'height' => 600)); ?> " target="_blank" class="button button-hero">Open it</a> <p> If not all is good - you'll see some kind of an error message. We'll discuss most frequent ones below. </p> </div> <div class="image-wrapper"> <img src="<?php echo $src[0]; ?> "> </div> </section> <section> <div> <h3>Image not found.</h3> <p> In most cases, that is because your WordPress installation uses a non-standard directory naming. You'll need to tell Timthumb where to look for images by adding <code>wp-content/uber-grid-timthumb-config.php</code> file and placing some code there: </p> <ul> <li>You can define <code>LOCAL_FILE_BASE_DIRECTORY</code> constant to tell TimThumb what directory matches the site root.</li> <li>You can change <code>$_GET['src']</code> value to forge the URL transmitted to match the directory paths in your filesystem.</li> </ul> </div> <div class="image-wrapper"> <img src="<?php echo UBERGRID_URL; ?> /assets/admin/images/image-troubleshooting/image-6-not-available.jpg"> </div> </section> <section> <div> <h3>Can't create a cache directory, or write to cache files.</h3> <p> In this case, it is best to create <code>wp-content/uber-grid-cache</code> directory with your FTP client or using your hosting control panel and set it 775 / RWXRWXR Unix access rights. </p> </div> <div class="image-wrapper"> <img src="<?php echo UBERGRID_URL; ?> /assets/admin/images/image-troubleshooting/image-7-restricted-access.jpg"> </div> </section> <?php }
function uber_grid_get_image_url($url, $options) { if (uber_grid_is_photon_enabled()) { return uber_grid_get_photon_url($url, $options); } return uber_grid_get_timthumb_url($url, $options); }