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

File

Development and Programming

slorenz's avatar
slorenz
38 posts
about 16 years ago
slorenz's avatar slorenz

I am using File to add multiple PDFs in a custom field, however, I can only get the first file uploaded to show. Am I doing something wrong here?

{if soft_file}<a href="http://{soft_file}">{soft_file}</a>
{/if}
       
Peter Lewis's avatar
Peter Lewis
280 posts
about 16 years ago
Peter Lewis's avatar Peter Lewis

@slorenz

{soft_file} is a single tag - you need a tag pair.

{if soft_file}{soft_file}<a href="http://{file_url}">{file_url}</a>
{/soft_file}{/if}

Edit: sorry, amended code - missed the href!

2nd Edit: From the docs…

Single Variables

    * {[custom_field]} — When used alone, the custom field will output the first uploaded image

Variable Pairs

    * {[custom_field]}…{/[custom_field]} — When used as a pair the contained code will loop, outputting all the uploaded files.
          o count — Numeric number of each file
          o total_results — Total number of files uploaded to the custom field
          o file_name — Filename of the uploaded file.
          o file_url — URL to the uploaded file.
          o file_thumb_name — Filename of the uploaded thumbnail.
          o file_thumb_url — URL to the uploaded thumbnail.
       
slorenz's avatar
slorenz
38 posts
about 16 years ago
slorenz's avatar slorenz

@Twobelowzero

Duh. Would help if I read the doc. Thanks!

       
cwpollock's avatar
cwpollock
72 posts
about 16 years ago
cwpollock's avatar cwpollock

I’m using file in a multi site. It’s an international site, so basically the other sites are copies of each other, with the language changed. I’m having some problems with file in that context. The first site works fine, but all the derivative sites (the sites that were copied from the first one), the files uploaded with file are not showing properly.

Example:

{if image_small}{image_small}{file_thumb_url}{/image_small}{if:else}{skin_url}images/ss_placeholder_small.gif{/if}

It actually passes the first case as true, but then doesn’t show anything inside of the tag pair.

       
cwpollock's avatar
cwpollock
72 posts
about 16 years ago
cwpollock's avatar cwpollock

Hey I fixed my own problem. The problem is the file is not really MSM ready. Here’s what I did:

Find this statement around line 1127 in 3.1.1

$SESS->cache['mh_file_ext_fields'] = $DB->query('SELECT * FROM exp_weblog_fields f, exp_upload_prefs p WHERE f.field_type="file" AND p.id=f.field_list_items');

Replace it with this:

// Is MSM enabled?
$msm = ($PREFS->ini('multiple_sites_enabled') == 'y') ? TRUE : FALSE;
    
// Get the current Site ID
$site_id = $PREFS->ini('site_id');

$SESS->cache['mh_file_ext_fields'] = $DB->query('SELECT * FROM exp_weblog_fields f, exp_upload_prefs p WHERE f.field_type="file" AND p.id=f.field_list_items' . ($msm ? " AND f.site_id = {$site_id}" : ""));

You’ll also need to add $PREFS to the global delcaration on line 1116

global $DB, $FNS, $TMPL, $EXT, $SESS, $PREFS;
       
simetro's avatar
simetro
3 posts
15 years ago
simetro's avatar simetro

Hi, I installed extension, but when I upload image that is smaller than specified max sizes it makes thumb with width and height specified.

example: original file is: 134x200px thumb is:670x1000px;

I set resize option to “Auto”. Maximum Image Height (in pixels): 1000px Max height:700px

Is there a chance that uploaded photo remain not resized if it is smaller than specified max width and height?

       
michiko23's avatar
michiko23
8 posts
15 years ago
michiko23's avatar michiko23
Hi, I installed extension, but when I upload image that is smaller than specified max sizes it makes thumb with width and height specified. example: original file is: 134x200px thumb is:670x1000px; I set resize option to “Auto”. Maximum Image Height (in pixels): 1000px Max height:700px Is there a chance that uploaded photo remain not resized if it is smaller than specified max width and height?

I posted this fix earlier.

In ext.mh_file_ext.php, right after the code

//  =============================================
//  Calculate Width/Height
//  =============================================
$dst_x = 0;
$dst_y = 0;                    
$dst_width = ($file_field['max_width']!='')?$file_field['max_width']:$dimensions[0];
$dst_height = ($file_field['max_height']!='')?$file_field['max_height']:$dimensions[1];

insert

if($dst_width > $src_width) {
    $dst_width = $src_width;
}
if($dst_height > $src_height) {
    $$dst_height = $src_height;
}

It will check to see if the original image is smaller than the max width or height. It will still create a thumbnail file with the same dimensions as the original image.

       
eyevariety's avatar
eyevariety
158 posts
15 years ago
eyevariety's avatar eyevariety

This extension is seriously outdated. Try a nGen File Field with ImgSizer for the same results- but much more flexibility and a better user experience.

       
Peter Lewis's avatar
Peter Lewis
280 posts
15 years ago
Peter Lewis's avatar Peter Lewis

@eyevariety: Saying it’s “seriously outdated” is an exageration - File still has some key features that aren’t available yet in nGen File Field - such as automatic resize on upload to prevent huge files from being uploaded and stored on the server.

I’ve converted 2 sites over to nGen File Field, only to convert them back again when client’s do stupid things.

There’s still life in it yet, although it would be good if Mark had time for an update 😊

       
eyevariety's avatar
eyevariety
158 posts
15 years ago
eyevariety's avatar eyevariety

I guess “outdated” is going too far- but being able to easily choose already uploaded files, and the renaming are light years ahead of Mark’s extension as far as user experience. I prevent my users from uploading huge files using the file upload folder’s settings. GD resize is decent but relying on it to resize an image multiple times - once at upload and then again at render for img sizer- sounds like unnecessary compression and jpg artifacting.

What both need is a visual file browser and a method for storing what articles an image has been used in. - IE wordpress’s media library. When we get there - things will really be accelerating for the end user experience.

       
mahalie's avatar
mahalie
60 posts
15 years ago
mahalie's avatar mahalie

Multi upload and image preview thumbnails stopped working.

Read through many of the pages of this thread and searched the forums but haven’t seen this yet. I upgraded to EE 1.6.7 (from 1.6.4) and Mark Huot’s File extension is no longer working. I’ve tried disabling all extensions except File, to no avail.

Currently I’m still able to upload an image, but I can’t upload more than one and the thumbnail previews have disappeared and are now replaced with a generic image icon. I have no idea about the image preview but noticed using Firebug that the upload field is there but set to display:none. Me things a jQuery collision may be happening?

Recently got FieldFrame and nGen File Field working, it’s great.

I’d like to move the whole site to nGen but I have many sections and hundreds and hundreds of files to move. Need to get this working again in the meantime!!

Any ideas?

p.s. PHP 5.5 & memory is 64MB.

       
mahalie's avatar
mahalie
60 posts
15 years ago
mahalie's avatar mahalie

My issue is fixed. At some point during an upgrade the settings in Section Administration › File Upload Preferences got reset/wiped so multiple uploads and thumbnails were disabled.

I’m going to leave that post up (sorry for polluting the thread) in case someone else makes the same mistake I did. Doh, so embarrassed.

       
adro's avatar
adro
110 posts
15 years ago
adro's avatar adro

I was wondering if anyone knows a way to make it so that I can choose multiple files when the Open File dialogue box comes up. The multiple file upload functionality is great, but in my particular case, I’m using file upload for pretty large image galleries with up to 100 pictures each. I was hoping there was a way I could just highlight all images and have them all add to the File field queued for upload…Anyone ever try doing this?

       
keighl's avatar
keighl
18 posts
15 years ago
keighl's avatar keighl

File loop …

Hi Everyone,

I love this extension, and I’m trying to figure out the best way to use the loop. I’ve allowed multiple uploads with the extension, and to display them in a template I’m using the {if [custom_field]}{/if}. They are images, and each one is being floated with css so they line up like a gallery. What I want is for the loop to spit out a bit of html after every third image … to keep things from going haywire on the rendered page.

Basically I want to create a kind of while loop for the multiple files. Could I do it with the Loop Plugin? Do I have to use PHP?

Here’s my code:

{if image}
      {image}
              {file_url}
      {/image}
{/if}

I’d really appreciate any help I can get! I’m kind of new to EE.

Thanks a ton:

  • Keighl
       
Matt Weinberg's avatar
Matt Weinberg
489 posts
15 years ago
Matt Weinberg's avatar Matt Weinberg
Basically I want to create a kind of while loop for the multiple files. Could I do it with the Loop Plugin? Do I have to use PHP?

You do need to use PHP.

Also worth checking out– The nGen File Field extension: http://ellislab.com/forums/viewthread/110252/

       
First 56 57 58 59 60 Last

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.