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

Bjørn Børresen's avatar
Bjørn Børresen
629 posts
16 years ago
Bjørn Børresen's avatar Bjørn Børresen

Yeah, I guess that’s what I’ll have to do .. don’t know what kind of license this thing has though; if I modify the code I’ll have to provide the modified extension to my users (or alternatively get Matt to update his with the code).

  • bjorn
       
Matt Weinberg's avatar
Matt Weinberg
489 posts
16 years ago
Matt Weinberg's avatar Matt Weinberg

Mark hasn’t been to this thread in quite a while.

Perhaps I’m wrong, but when I’ve found a glitch or needed to extend functionality in the extension I’ve made the change myself for my users. I haven’t distributed it outside of personal projects, though.

       
Bjørn Børresen's avatar
Bjørn Børresen
629 posts
16 years ago
Bjørn Børresen's avatar Bjørn Børresen

Ok, I’ll have to provide it as a download, so I guess it’s a special case. I’ll look into it some more. Here’s to EE 2.0 coming with this feature by default ..

Anyway, thanks for all your help 😊

  • bjorn
       
Bjørn Børresen's avatar
Bjørn Børresen
629 posts
16 years ago
Bjørn Børresen's avatar Bjørn Børresen

For those interested, to get an additional file_path variable which returns ‘/images/uploads/theimage.jpg’ I modified the array at line 1223 in ext.mh_file_ext.php to look like this:

$var = array(
                        'count' => $count+1,
                        'total_results' => $total_results,
                        'file_name' => $file,
                        'file_path' => "/".str_replace($PREFS->ini('site_url'), "", $file_field['url']).$file,
                        'file_url' => $FNS->remove_double_slashes($file_field['url'].'/'.$file),
                        'file'.$this->thumb_suffix.'_name' => $thumb,
                        'file'.$this->thumb_suffix.'_url' => $thumb_url
                    );
  • bjorn
       
fostermade's avatar
fostermade
97 posts
16 years ago
fostermade's avatar fostermade

Hey everyone…

I’m having an issue where file is only adding the image path to a portion of the images in my weblog entries loop. About half of the images have the path and half are only the file name. Has anyone seen this before? Any ideas?

Thanks, Shawn

       
Matt Weinberg's avatar
Matt Weinberg
489 posts
16 years ago
Matt Weinberg's avatar Matt Weinberg

Shawn– what code are you using?

       
fostermade's avatar
fostermade
97 posts
16 years ago
fostermade's avatar fostermade

Here’s the code. “{feature_thumb}” returns the file name for some of the results and the path+file_name for others. Thanks for your help.

-Shawn

{exp:weblog:entries weblog="advice" limit="20" offset="1" orderby="date" disable="member_data|pagination|trackbacks" status="open" dynamic="off"}
        <li>
            {if feature_thumb}
                <a href="http://{entry_id_path=article}{url_title}">{feature_thumb}</a>
            {if:else}
                <a href="http://{entry_id_path=article}{url_title}">/assets/images/shared/feature_thumb.jpg</a>
            {/if}
            <div>
                <h3><a href="http://{entry_id_path=">{title}</a></h3>
                {entry_date format="%F %d, %Y"}
            </div>
        </li>
        {/exp:weblog:entries}
       
Matt Weinberg's avatar
Matt Weinberg
489 posts
16 years ago
Matt Weinberg's avatar Matt Weinberg

This may be a weird parsing order issue. Out of curiosity, what happens if you split the if into two simple conditionals?

{if feature_thumb}
                <a href="http://{entry_id_path=article}{url_title}">{feature_thumb}</a>
            {/if}
            {if feature_thumb == ""}
                <a href="http://{entry_id_path=article}{url_title}">/assets/images/shared/feature_thumb.jpg</a>
            {/if}
       
fostermade's avatar
fostermade
97 posts
16 years ago
fostermade's avatar fostermade

I appreciate the response. It still does the same thing though. Any other ideas?

       
fostermade's avatar
fostermade
97 posts
16 years ago
fostermade's avatar fostermade

Thanks for the help Matt.

This is a note that uploading files with “_thumb” appended to the name causes a problem w/ file.

-Shawn

       
MeanStudios's avatar
MeanStudios
335 posts
16 years ago
MeanStudios's avatar MeanStudios

Not sure if this can be implemented but it would be awesome if you could have an option of having a text field for each upload box to put in a caption when using the multiple images option. That way each image in an entry can have it’s own caption. Maybe when it saves the data to the exp_weblog_data table it could look like this:

file1.jpg|Caption for file1.jpg
file2.jpg|Caption for file2.jpg
file3.jpg|Caption for file3.jpg
file4.jpg|Caption for file4.jpg
       
MeanStudios's avatar
MeanStudios
335 posts
16 years ago
MeanStudios's avatar MeanStudios

Alright, I successfully hacked this extension to include captions. The caption field only shows up for the File Fields that have the Multiple Uploads enabled. To use it in the template, you use the variable {caption}. If the caption is not set then it will spit out the file name. It doesn’t add any extra fields in the exp_weblog_fields or exp_weblog_data tables, it just appends the caption to each file like I posted above.

It’s probably a crap job but it works heh. Since I’m not too confident in the code I’m not going to post it publicly. If anyone wants it, just send me a PM.

       
boswebdev's avatar
boswebdev
52 posts
16 years ago
boswebdev's avatar boswebdev

Cody, I actually did this a while ago for a project, along with descriptions. However when it came to thumbs/descriptions/captions the | delimiter got a little craptacular, so I changed the storage to serialized arrays. Also, watch out how you use the fill the repeating blocks, I noticed LG’s regular method would cause blank entries on items with the same file name or, in your case, caption as well. I planned on releasing the update I had made, but I haven’t had time to clean it up as it was for a site that I just needed this specific functionality for and didn’t care for some of the pieces LG included originally.

       
MeanStudios's avatar
MeanStudios
335 posts
16 years ago
MeanStudios's avatar MeanStudios

LG? I’m thinking you got the author of this extension confused hehe. Mark Huot made this extension, not Levi.

Also, I’m not sure what you mean by repeating blocks? There won’t be any duplicate file names since you can’t have duplicate files on your server. Also the way I’m doing it, having the same caption for more than one picture works just fine. I like the idea of putting them into serialized arrays though heh. Anyways, this is working just fine for my own purposes 😊.

       
boswebdev's avatar
boswebdev
52 posts
16 years ago
boswebdev's avatar boswebdev

Ah, yeah- Mark and Levi have become slightly interchangable in my mind I suppose. Both great contributors! Sorry for the mix up. Anyway- I just grabbed the file and cleaned it up a bit if you wanted to take a look. I was also supporting .mov and .wav uplaods and using custom thumbnails for each of them, and getting video resolution sizes with the php getid3 lib. As you can see on lines 1445/1447 you can either not use those file types or change the file paths if you like. I’m sure there’s other things wrong with it, but I made it quickly for a specific project and purpose. Hopefully I’m not breaching any copyrights by Mark (?)

Enjoy.

       
First 47 48 49 50 51 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.