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

joshclark17's avatar
joshclark17
194 posts
16 years ago
joshclark17's avatar joshclark17

Thanks Ryan- I actually took a stab at it and put it at line 293 above the return. I appreciate your help. I’m not a developer at all, and my understanding of php is cursory at best. I’m very tentative about jumping into the code, and I guess I should be more confident in tinkering, because my guess worked, and the errors have gone away.

I guess the next step in my development as a web designer is to get a better grasp on the inner working of EE. Thanks for your direction.

Best,

Josh

       
Ryan M.'s avatar
Ryan M.
1,511 posts
16 years ago
Ryan M.'s avatar Ryan M.

No prob. This whole post-EE 1.6.5 custom field format thing was a big PITA in my opinion. I rely on a lot of add-ons to help make EE exceptional, and there are SO MANY add-ons out there (extensions, primarily, as this is a custom field/control panel thing) that haven’t been updated with this relatively minor fix. Many people have no idea how or why their stuff suddenly doesn’t work. They want to plugin in their add-on and go, without having to think about (and understandably so). Glad you got it sorted out!

       
michiko23's avatar
michiko23
8 posts
16 years ago
michiko23's avatar michiko23
is there a way to NOT resize images when the are smapper than Max_width, only if they are larger? Right now it resizes the images to the max_width, even if they are smaller. I need the resize only for larger images.

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.

       
bene's avatar
bene
20 posts
16 years ago
bene's avatar bene

Hello Mark,

excellent extension, thank you for this! We’re using version 3.1.1 but we’re having a small issue. When looping through the dataset of the field for some reason the {count} variable for the last entry is always 1

An example, there are 4 photos in the field called ‘photos’

{photos} {count} - {file_url}<br> {/photos}

this returns 1 - file_url#1 2 - file_url#2 3 - file_url#3 1 - file_url#4

as you can see the last {count} is incorrect. This wouldn’t be too much of problem, but we’re using this variable in the detail-pages to show ‘previous’ and ‘next’ links with some (little) intelligence that uses the {count} variable to determine the previous or next photo to show.

Do you have any idea?

best regards, Tim

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

Mark hasn’t been around in quite a while.

There are some known glitches with this extension and {count}. The best workaround I’ve used is counting with PHP instead of the extension variable.

       
Chris Newton's avatar
Chris Newton
440 posts
16 years ago
Chris Newton's avatar Chris Newton

I’ve been killing bugs in an off-shoot of his extension. I’ll see if I can fix that one.

       
Jonathan Morgan's avatar
Jonathan Morgan
51 posts
16 years ago
Jonathan Morgan's avatar Jonathan Morgan

Mark,

Thank you so much for this extension. For a long time I’ve felt that the file/image upload that is built into EE was very poor for UI, now I can have even my least tech-savvy clients upload images.

You’ll just need to change a few lines in the extension file. Around line #1030 under the heading “Write File” Change from:
if(@imagegif($dst_img, $dst) !== false) {}
else if(@imagejpeg($dst_img, $dst) !== false) {}
else if(@imagepng($dst_img, $dst) !== false) {}
Change to:
if(@imagejpeg($dst_img, $dst) !== false) {}
else if(@imagegif($dst_img, $dst) !== false) {}
else if(@imagepng($dst_img, $dst) !== false) {}
This will take care of your problem and save your jpeg as a true jpeg. The default image size is set to 60% quality (this is medium in Photoshop)… if you want it set to a higher quality add the number below. (90 means 90% image quality)
if(@imagejpeg($dst_img, $dst, 90) !== false) {}

And Silencio, thanks for this code! It solved a huge problem for me!

       
Ray Brown's avatar
Ray Brown
33 posts
16 years ago
Ray Brown's avatar Ray Brown

Hey all,

I apologize if this has already been covered, but searching didn’t pull anything up. Feel free to link me if this topic’s already been covered.

I’m getting some funny behavior using File 3.1.1 in EE 1.6.7. Here’s the deal. I’ve created an upload destination in Admin > Weblog Administration > File Upload Preferences for product images. This destination is configured to allow multiple uploads.

I’ve also created a weblog field group for my products, with ‘product_image’ set to a field type of ‘file’ and is pointed to the proper file upload destination.

When I try to publish a product entry with N images, N copies of the last image file get ‘created.’ By this, I mean that only one image is physically created (see ‘single-file.jpg’), but the entry shows links to N copies of the image (see ‘multiple-files.jpg’).

Any ideas on what the fix is?

       
Chris Newton's avatar
Chris Newton
440 posts
16 years ago
Chris Newton's avatar Chris Newton

There’s a bug fix for this.

Around line 761 look for

//  =============================================
            //  Rewrite (or Code) File Names?
            //  =============================================
            if($this->rewrite_filenames === TRUE)
            {
                foreach($file_names as $file_key=>$file_name)
                {
                    $file = $this->_pieces($file_name);
                    $file_names[$file_key] = $this->_code().$file['ext'];
                }
            }

replace with:

//  =============================================
            //  Rewrite (or Code) File Names?
            //  =============================================
            if($this->rewrite_filenames === TRUE)
            {
                foreach($file_names as $file_key=>$file_name)
                {
                    $file = $this->_pieces($file_name);
                    //$file_names[$file_key] = $this->_code().$file['ext'];
                    // BUG FIX
                    $file_names[$file_key] = $this->_code().$file_key.$file['ext'];
                    
                }
            }
       
delvalcollege's avatar
delvalcollege
8 posts
16 years ago
delvalcollege's avatar delvalcollege

Hello,

I apologize if this answer was already posted in this thread. I looked, but didn’t see an answer that worked.

I’m getting the following error for File v.3.1.1 on EE build 1.6.6 :

Notice: Undefined index: news_image in E:\public_html\cms\system\extensions\ext.mh_file_ext.php on line 529

$this->_set_prefs($file_field['news_image']);

I’ve checked the Admin > Weblog Administration > Field Groups, and the Field Group Name is the same as in the ext.mh_file_ext.php file. I’ve also checked File Upload preferences, and I have my default path directory and URL directory entered correctly.

I also have my custom field (news_image) selected as the upload location for the right field type.

Any suggestions on where to go from here?

Thanks in advance!

       
Chris Newton's avatar
Chris Newton
440 posts
16 years ago
Chris Newton's avatar Chris Newton

Do you have multiple weblogs using file? Or do you have file assigned as a gypsy field?

       
delvalcollege's avatar
delvalcollege
8 posts
16 years ago
delvalcollege's avatar delvalcollege

We’re only using one weblog.

We’re about 95% done transitioning from a Linux server to a Windows one (not my choice :down: ) and this is one of the few snags left.

       
Chris Newton's avatar
Chris Newton
440 posts
16 years ago
Chris Newton's avatar Chris Newton

Hm. Oh, what’s the short_name of your file field? Did I miss it. Anyway, I notice the other day that I had a similar problem when I named my field something like “File”

If you keep having problems, PM me. I’ve been rebuilding this extension lately, I might be able to either figure out what the problem is, or provide you with a replacement version that works.

       
delvalcollege's avatar
delvalcollege
8 posts
16 years ago
delvalcollege's avatar delvalcollege

The short name is news_image.

Thanks for the help so far. I really can’t think of anything else.

       
hothousegraphix's avatar
hothousegraphix
851 posts
16 years ago
hothousegraphix's avatar hothousegraphix

Is there anyway to use the “Auto” sizing method but not generate the additional thumbs with v3.1.1?

       
First 50 51 52 53 54 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.