Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE » How To » proportional scaling of thumbnails in filepicker (for images)
Re: proportional scaling of thumbnails in filepicker (for images) [message #1464 is a reply to message #1462] Mon, 14 July 2008 16:05 Go to previous messageGo to previous message
ikatz is currently offline  ikatz
Messages: 40
Registered: December 2007
Location: Durham, NH
Member
I see the problem.

std.filepicker.list1.xsl is looking for a "/root/params/image_width" instead of "/root/params/imagewidth"

With this patch, the thumbnails in the filepicker screen will properly respond to the values in the screen structure file:
diff --git a/xsl/std.filepicker.list1.xsl b/xsl/std.filepicker.list1.xsl
index 320a20d..a14094a 100644
--- a/xsl/std.filepicker.list1.xsl
+++ b/xsl/std.filepicker.list1.xsl
@@ -31,8 +31,8 @@
 <xsl:variable name="image_directory" select="/root/params/image_directory" />
 <xsl:variable name="image_width">
   <xsl:choose>
-    <xsl:when test="/root/params/image_width">
-      <xsl:value-of select="/root/params/image_width" />
+    <xsl:when test="/root/params/imagewidth">
+      <xsl:value-of select="/root/params/imagewidth" />
     </xsl:when>
     <xsl:otherwise>
       <xsl:value-of select="//root/structure/main/row/cell/@imagewidth" />
@@ -41,8 +41,8 @@
 </xsl:variable>
 <xsl:variable name="image_height">
   <xsl:choose>
-    <xsl:when test="/root/params/image_height">
-      <xsl:value-of select="/root/params/image_height" />
+    <xsl:when test="/root/params/imageheight">
+      <xsl:value-of select="/root/params/imageheight" />
     </xsl:when>
     <xsl:otherwise>
       <xsl:value-of select="//root/structure/main/row/cell/@imageheight" />


I would still like to have the images be scaled proportionally to fit into a bounding box specified by imagewidth and imageheight. Based on my reading of your code, it would have to be implemented something like this:

  1. std.filepicker1.inc will perform additional processing on the files it reads, based on their type.

    • For images, the width and height will be extracted with getimagesize($file)
    • For other files... some other relevant metadata?

  2. std.table.class.inc will need setFieldArray() to accept a second argument for an array of metadata key/value pairs whose indexes line up with the $file_list
  3. include.xml.*.inc will need to accept an array of key/value pairs for a file's row entry and insert them using setAttribute($key, $value)
  4. std.filepicker.list1.xsl will need to run the scaling code using the image dimensions stored as attributes in the "/root/file" tags and the bounding boxes specified in "/root/params/image*"


Is there a better way to do any part of that? I am trying to decide whether it is worth doing.
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Weird Parent->Child->Child screens help
Next Topic: override noedit on foreign field in multi2
Goto Forum:
  


Current Time: Tue May 14 04:29:31 EDT 2024

Total time taken to generate the page: 0.00994 seconds