[SPT/CWIS] new to the list, question about uploading images

Sonya Norris NorrisS2 at michigan.gov
Fri Sep 1 11:08:23 CDT 2006


Hello All,
I'm new to this list, working with the Scout Portal Toolklit for the
Michigan eLibrary at the Library of Michigan.

My quandry is this: we can't seem to properly upload images to adjoin
records. Or rather, we can upload them just fine but the php is messing
with the image dimensions in such a way that the images don't display.
The lines of code that seem to be causing the damage are in the
SPT--SPTImage.php file and I've starred the lines below that are
generating error messages.

  # generate preview image and calculate width and height
                $SrcImage->ScaleTo($MaxPreviewWidth, $MaxPreviewHeight,
TRUE);
                $SrcImage->SaveAs($this->PreviewFileName,
IMGTYPE_JPEG);
                if ($SrcImage->Status() != AI_OKAY)
                {
                    echo "preview save as failed<br>";
                    $this->ErrorStatus = $SrcImage->Status();
                    return;
                }
                if ($MaxPreviewWidth > $MaxPreviewHeight)
                {
                    $this->PreviewWidth = $MaxPreviewWidth;
                    $this->PreviewHeight = ($MaxPreviewWidth *
$SrcImage->YSize()) / $SrcImage->XSize();
                }
                else
                {
                    *******$this->PreviewWidth = ($MaxPreviewHeight *
$SrcImage->XSize()) / $SrcImage->YSize();
                    $this->PreviewHeight = $MaxPreviewHeight;
                }

                # generate thumbnail image and calculate width and
height
                $SrcImage->ScaleTo($MaxThumbnailWidth,
$MaxThumbnailHeight, TRUE);
                $SrcImage->SaveAs($this->ThumbnailFileName,
IMGTYPE_JPEG);
                if ($SrcImage->Status() != AI_OKAY)
                {
                    echo "thumbnail SaveAs failed.<br>";
                    $this->ErrorStatus = $SrcImage->Status();
                    return;
                }
                if ($MaxThumbnailWidth > $MaxThumbnailHeight)
                {
                    $this->ThumbnailWidth = $MaxThumbnailWidth;
                    $this->ThumbnailHeight = ($MaxThumbnailWidth *
$SrcImage->YSize()) / $SrcImage->XSize();
                }
                else
                {
                   ******* $this->ThumbnailWidth = ($MaxThumbnailHeight
* $SrcImage->XSize()) / $SrcImage->YSize();
                    $this->ThumbnailHeight = $MaxThumbnailHeight;
                }

Has anyone else run into this problem, or knows how to fix this
problem? All suggestions much appreciated.

Sonya

--------------------------------------
Sonya Schryer Norris

Web Site Administrator
Library of Michigan
702 W Kalamazoo St
Lansing, MI 48915
phone: (517) 373-4457 or
fax: (517) 373-5700

http://www.michigan.gov/libraryofmichigan



More information about the SPT-CWIS-Users mailing list