This topic is locked

pictures

11/10/2005 9:58:05 PM
PHPRunner General questions
O
omegix author

Hi,
I have set up a phprunner project so that a user can upload a picture, and have it viewed in both the 'list' and the 'view.'
What I would like to do is specify a set width, and have the picture resize the length accordingly.
Example: Uploaded picture is 640x480 pixels in size. I want to display the picture with

a width of 100, and have the picture resize accordingly so that the image does not become distorted.
Is there a way to do this in phprunner? I see that if I specify a dimension, I have to specify both width AND length.
Thanks,

Jeff

admin 11/11/2005

Jeff,
you can use thumbnail generation PHPRunner feature.

It's not supported in PHPRunner wizard yet, but you can enable it modifying generated files.
Here is the instruction on how to do that.
Please set up a PHPRunner project with "File based image" View type and "Document upload" Edit type. You will need a VARCHAR field for this.

Build the pages.

Open include\..._variables.php file in PHPRunner Output folder with a text editor and locate the following code snippet at the end of the file.

$thumbnail_fields = array();

// $thumbnail_fields = array("Field1","Field2");

// field names are case-sensitive!

$thumbnail_prefixes = array();

// $thumbnailprefixes = array("Field1"=>"t1" , "Field2"=>"t2_");

$thumbnail_maxsize = 150;

----------------------------------

$thumbnail_fields = array("Image");

// $thumbnail_fields = array("Field1","Field2");

// field names are case-sensitive!

$thumbnailprefixes = array("Image"=>"t");

// $thumbnailprefixes = array("Field1"=>"t1" , "Field2"=>"t2_");

$thumbnail_maxsize = 120;



where "Image" is your VARCHAR field used for Image displaying.
After you save the file the pages will work the following way:

When you upload a new image (i.e. pic00001.jpg) with a horizontal or vertical size more than 120 pixels it will be copied under "t_pic00001.gif" filename and reduced to fit the size.

Then List page will display the reduced copy of an image and if you click it the original image will be dysplayed in a popup window.

O
omegix author 11/11/2005

I made these changes, but recieved this php error:

2

Error description imagecreatefromstring(): No JPEG support in this PHP build

URL www.asmsalumni.org/database/asms2005_edit.php

Error file /home/home2/home/www/www.asmsalumni.org/root/database/include/asms2005_functions.php

Error line 1427

SQL query update `asms2005` set

admin 11/14/2005

Jeff,
this error means that you should update your PHP installation to use the thumbnails feature.

Here is where you can start: http://www.php.net