stoppeddesign, the upgrade, and you

to continue using stoppdesign with the upgrade, add these lines to the corresponding files:

line 23 and on of i.php should look like this:
if(isset($_GET['s']) && $_GET['s'] < 3000) { // Disallow abusive size requests.
if ($_GET['s'] == "thumb") {
$thumb = true;
if ($_GET['f'] == "true") {
$thumb_crop = true;
$thumb_size = 230;
$thumb_crop_width = 210;
$thumb_crop_height = 60;};
}
else {
$thumb = false;
}
$size = $_GET['s'];
}

--------
you are adding the
if ($_GET['f'] == "true") {
$thumb_crop = true;
$thumb_size = 230;
$thumb_crop_width = 210;
$thumb_crop_height = 60;};
}
-------
and template-functions.php should have this block of code pasted in between functions, around line 534 (basically after the printAlbumThumbImage function):
function printAlbumThumbImageStopdesign($alt, $class=NULL, $id=NULL) {
echo "<img src=\"" . getAlbumThumb() . "&f=true\" alt=\"$alt\" width=\"210\" height=\"60\"" .
(($class) ? " class=\"$class\"" : "") .
(($id) ? " id=\"$id\"" : "") . " />";
}

Comments

  • trisweb Administrator
    Ahhh... forgot about you hackers ;-) I meant to put this feature (custom-cropped/sized thumbnails) into this version. I guess it can wait til the next, which should take much less time than this one did.
  • Which i.php and template.functions.php are we modifying ? The one in the theme or the main directory ?

    What about the second modification (you are adding the
    if ($_GET['f'] == "true") {), where is that going ?

    Erik
  • So I made the modification to the files in the main directory and this is what I get:

    http://www.generalmagic.org/gallery/

    Everything seems to work ok but the images themselves do not show. Any idea ?

    I was upgrading from 1.01beta so I didn't re-do any other modification since I had the theme working previously. Was that the wrong way to do it ? Should I re-install the theme ?
  • please just ignore me at this point, it's just a comedy of errors on my part.
  • Ok, now I think I got every thing right but as a consequence to the migration, it seems that the thumbnail image is either right for the gallery thumbnail or its attached photo thumbail.

    Examples:
    Animal & Face albums on : http://www.generalmagic.org/gallery/archive.php
    and the photo thumbnail on:
    http://www.generalmagic.org/gallery/index.php?album=Faces
    and
    http://www.generalmagic.org/gallery/index.php?album=Miscellaneous&image=Painting_1903_s.jpg
    for example.

    If I clear the album cache and reload a page with a thumbnail (let's say the gallery page), it'll get it right but the photo thumbnail will be wrong for the other entity (say the next photo thumbnail).

    Erik
  • trisweb Administrator
    Yep, that's because it's a hack and doesn't save the wider images with different filenames...

    I think 1.0.2 made this worse because it doesn't reprocess as much (a good thing). Once we make custom thumbs a part of the core, these problems should disappear (ntm we can include the stopdesign theme with the release ;-)
  • shoot! i forgot something...edasque, try making these changes to your config.php, then clear any cache files for the images that are screwed up (or all)

    $conf['image_size'] = 480;
    $conf['image_use_longest_side'] = true;
    $conf['thumb_crop'] = true;
    $conf['thumb_crop_width'] = 80;
    $conf['thumb_crop_height'] = 80;
    $conf['thumb_size'] = 100;
  • I already had all of this (I think those are the default). I cleared all the cache. It keeps making thumbnail either elongated for the highlighted photo or short for the album higlight depending on which you hit first.
  • trisweb Administrator
    What you see is the correct behavior for the code, edasque. The hack doesn't make a different filename for the two thumbnails when it should to keep them separate. To get it working, you can add something to the filename.

    Change line 37 of i.php to:

    `$newfilename = "/{$album}_{$image}_{$size}" . ($_GET['f'] ? "_wide" : "") . ".jpg";`

    I haven't tested this, but it should work great.
  • sorry if I am being dense but with all the modifications, I don't know if I am looking at the right line.

    Should I add this code to the end of:
    if ($_GET['f'] == "true") {
    $thumb_crop = true;
    $thumb_size = 230;
    $thumb_crop_width = 210;
    $thumb_crop_height = 60;

    or right after:
    } else {
    $thumb = false;

    Isn't it being overriden by:
    $newfilename = "/{$album}_{$image}_{$size}.jpg";
    in any case (around line 48 or so ?) Or should we check if the newfilename varriable is empty before (re) assigning it ?

    I do dab in code but don't know much about PHP.

    Erik
  • Answering my own post, this seems to have worked,

    around line 48: if (empty($newfilename)) { $newfilename = "/{$album}_{$image}_{$size}.jpg"; }

    and

    $newfilename = "/{$album}_{$image}_{$size}" . ($_GET['f'] ? "_wide" : "") . ".jpg";

    was added right after

    if ($_GET['f'] == "true") {
    $thumb_crop = true;
    $thumb_size = 230;
    $thumb_crop_width = 210;
    $thumb_crop_height = 60;

    This now works for me.
  • trisweb Administrator
    Excellent, thought so.

    Like I said, I'll add native custom thumb sizes to a future release so we won't have to worry about hacking.

    For future reference, I meant replace the line:

    `$newfilename = "/{$album}_{$image}_{$size}.jpg";`

    with the line:

    `$newfilename = "/{$album}_{$image}_{$size}" . ($_GET['f'] ? "_wide" : "") . ".jpg";`

    but what you have should work fine as well, just a little kludgy.
  • Just a heads up, I noticed define('OFFSET_PATH', true); is missing int he i.php distributed with stoppeddesign.

    I had to add this one in to fix the images on the main image.php page being displayed.
Sign In or Register to comment.