We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Mark Huot File Extension

Development and Programming

bkuberek's avatar
bkuberek
124 posts
16 years ago
bkuberek's avatar bkuberek

just found one bug. The {count} variable doesn’t increment right. It was switching between 1 and 2.

       
Nico Smit's avatar
Nico Smit
48 posts
16 years ago
Nico Smit's avatar Nico Smit

Hi lockwesmonster,

Any news about progress of the extension?

       
October11's avatar
October11
183 posts
16 years ago
October11's avatar October11

Hmm, not getting the Upload Button !? Should there be one ?

       
Sceneshift's avatar
Sceneshift
39 posts
16 years ago
Sceneshift's avatar Sceneshift

Hey guys, wonder if you can help me.

I have a listing of products and I want to display a small thumbnail next to each listing using this extension. Is there a way to modify this extension so that it creates a thumbnail version of the uploaded image with _th on the end so I don’t need to add a new tag?

I’d much rather have smaller images than shrink the large images since there will be a lot of products on display at once.

Thanks!

       
notacouch's avatar
notacouch
92 posts
16 years ago
notacouch's avatar notacouch
Hey guys, wonder if you can help me. I have a listing of products and I want to display a small thumbnail next to each listing using this extension. Is there a way to modify this extension so that it creates a thumbnail version of the uploaded image with _th on the end so I don’t need to add a new tag? I’d much rather have smaller images than shrink the large images since there will be a lot of products on display at once. Thanks!

For thumbnails I’ve been using File in conjunction with imgsizer. http://www.lumis.com/page/imgsizer/

Sample usage:

{file_field}
{exp:imgsizer:size src="{file_url}" width="220" height="220"}
  {sized}
{/exp:imgsizer:size}
{/file_field}

{sized} is the local cached address, e.g. “/images/uploads/cache/image_name_220x220.jpg” so it will only create the image if it doesn’t exist already.

       
rockthenroll's avatar
rockthenroll
485 posts
16 years ago
rockthenroll's avatar rockthenroll

@lockwesmonster That looks brilliant! Can’t wait for the release!

       
monteconsulting's avatar
monteconsulting
35 posts
16 years ago
monteconsulting's avatar monteconsulting

Has anyone heard from lockwesmonster? That would be such great functionality.

       
Gabriel's avatar
Gabriel
130 posts
16 years ago
Gabriel's avatar Gabriel
ORIGINAL CODE(looking at the URI hidden field)
if (isset($options['hidden_fields']['URI']) && $options['hidden_fields']['URI']=='/post/images/')
   $options['enctype']='multi';
mdesign’s MOD (changing which hidden field to look at)
if (isset($options['hidden_fields']['weblog_id']) && $options['hidden_fields']['weblog_id']=='19')
   $options['enctype']='multi';

I’ve got tree weblogs using the same field group. Each weblog has own SAEF. File upload working only for one weblog. How to modify code above to work for more than one weblog?

       
orezz's avatar
orezz
43 posts
16 years ago
orezz's avatar orezz

I also tried to use it with different weblogs. And I have also the problem it isn’t working. Somebody who has an idea.

       
Wes Rice's avatar
Wes Rice
103 posts
16 years ago
Wes Rice's avatar Wes Rice

Hey everyone,

I apologize for my absence, but I wanted to update everyone where I stand with my extension of Mark Huot’s file plugin.

Since my last post, noticed some pretty large bugs with the way I extended the extension. In summary, the way I had coded it the extension would not have allowed for multiple file instances of custom fields on the same page. That is too big of a problem to overlook in my opinion.

So, I recently re-wrote my part of the extension for a project that I recently pushed out. It allows for adding a title, caption and order number per file. For now, I have abandoned the feature that will automatically unzip files. It was causing its own set of problems.

Once I have some time to review my code again, comment it out, and organize it a little better I will post it here in the forum. However, I will not be able to provide support for this. I simply do not have the time.

       
simplyee's avatar
simplyee
104 posts
16 years ago
simplyee's avatar simplyee

Have an issue that is related to this extension, and while I understand it’s not supoorted, hope that someone might be able to help.

The extension works on other installs of EE, but on this we get:

MySQL ERROR:

Error Number: 1064

Description: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 1' at line 1

Query: SELECT * FROM `exp_weblog_titles` WHERE entry_id = LIMIT 1

When we deinstall the file extension all is good.

Any ideas? Happened to anyone else here and is there a fix?

Thanks in advance.

       
notacouch's avatar
notacouch
92 posts
16 years ago
notacouch's avatar notacouch

Hi folks,

I just worked on the File extension to quickly add up/down buttons/links.

I haven’t tested it extensively but it seems to be working fine.

requires jQuery (i didn’t bother to add jQuery here since several extensions already do)

in language/english/lang.mh_file_ext.php i added this between ‘file’ and ‘remove’

'adjust' =>
'Adjust',

in ext.mh_file_ext.php under Table Headings

$r.= '<tr>';
         $r.= '<td class="tableHeadingAlt">';
         $r.= $LANG->line('file');
         $r.= '</td>';
         if( $this->allow_multiple !== FALSE )
         {
         $r.= '<td class="tableHeadingAlt" align="center">';
         $r.= $LANG->line('adjust');
         $r.= '</td>';
         }
         $r.= '<td class="tableHeadingAlt" align="right">';
         $r.= $LANG->line('remove');
         $r.= '</td>';
         $r.= '</tr>';

under Print Row comment i added the following above the “remove” column (i’ll quote that after)

if( $this->allow_multiple !== FALSE )
            {
            $r.= '<td class="'.$class_name.'" align="center">';
            $r.= '<a href="#">'.PATH_CP_IMG.</a> ';
            $r.= '<a href="#">'.PATH_CP_IMG.</a>';
            $r.= '</td>';
            }

hrm… some reason the inline javascript doesn’t get posted, add these to the links onclick=”swapFiles(this, \’up\’); return false;” onclick=”swapFiles(this, \’down\’); return false;”

(the “remove” column)

$r.= '<td class="'.$class_name.'" align="right">';

screenshot attached below, and javascript posted afterwards

       
notacouch's avatar
notacouch
92 posts
16 years ago
notacouch's avatar notacouch

and at the end of the javascript by the end of the file

function grabImageFromHref( href )
{
   var pieces = href.split("/");
   return pieces[pieces.length-1];
}
function swapFile(above, below, _table)
{
   // Swap class names so the table row colors are seemless
   $("td", below).each( function(i, el)
   {
      var _el = $(el);
      if( _el.hasClass("tableCellOne") )
      {
         _el.removeClass("tableCellOne");
         _el.addClass("tableCellTwo");
      }
      else
      {
         _el.removeClass("tableCellTwo");
         _el.addClass("tableCellOne");
      }
   });
   $("td", above).each( function(i, el)
   {
      var _el = $(el);
      if( _el.hasClass("tableCellOne") )
      {
         _el.removeClass("tableCellOne");
         _el.addClass("tableCellTwo");
      }
      else
      {
         _el.removeClass("tableCellTwo");
         _el.addClass("tableCellOne");
      }
   });

   // Break the input info into separate lines and
   // compare by line instead of regex or substr because
   // e.g. "Filename" would match within "Copy_of_Filename"
   var href1 = $("a:first", above);
   var href2 = $("a:first", below);
   var img1 = grabImageFromHref( href1.attr("href") );
   var img2 = grabImageFromHref( href2.attr("href") );

   // Grab existing file information from parent table
   // (there is another hidden input but that is the formatting type)
   var _data = $("td > input[type=hidden]",_table.parent().parent());
   var original_value = _data[0].value;
   var multiline_value = original_value.split(/[\n\r]+/);
   var y = multiline_value.length;
   while( y-- )
   {
     if( multiline_value[y] == img1 )
     {
       multiline_value[y] = img2;
       multiline_value[y+1] = img1;
       break;
     }
   }
   var new_value = "";
   y = multiline_value.length;
   while( y-- )
   {
      new_value = multiline_value[y] + "\n" + new_value;
   }

   // swap post and table rows
   _data[0].value = new_value;
   below.insertBefore(above);
}
function swapFiles( self, dir )
{
   if( window["jQuery"] !== undefined )
   {
      // table row
      var _self = $(self).parent().parent();
      // TBODY
      var _table = _self.parent().parent().parent();
      var _rows = $("tr", _table);
      var l = _rows.length;

      if( dir == "up" )
      {
         if(_self.get(0) !== _rows[1] )
         {
            // Loop through the rows until we have a precise match of elements
            while( l-- )
            {
               if( _rows[l] === _self.get(0) )
               {
                  var _previous = $(_rows[l-1])
                  swapFile( _previous, _self, _table );
                  return;
               }
            }
            //console.log("good to go up");
         }else
         {
            //console.log("not good to go up");
         }
      }else if( dir == "down")
      {
         if(_self.get(0) !== _rows[_rows.length - 2] )
         {
            while( l-- )
            {
               if( _rows[l] === _self.get(0) )
               {
                  var _next = $(_rows[l+1]);
                  swapFile( _self, _next, _table );
               }
            }
            //console.log("good to go down");
         }else
         {
            //console.log("not good to go down");
         }
      }
   }
}
       
notacouch's avatar
notacouch
92 posts
16 years ago
notacouch's avatar notacouch

(cleaned up the javascript a bit so it fit in the post above)

       
mooo's avatar
mooo
168 posts
16 years ago
mooo's avatar mooo
(cleaned up the javascript a bit so it fit in the post above)

Where do I put the javascript you included above?

       
1 2 3 4

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.