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
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!
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.
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
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:Change to:if(@imagegif($dst_img, $dst) !== false) {} else if(@imagejpeg($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) !== false) {} else if(@imagegif($dst_img, $dst) !== false) {} else if(@imagepng($dst_img, $dst) !== false) {}
if(@imagejpeg($dst_img, $dst, 90) !== false) {}
And Silencio, thanks for this code! It solved a huge problem for me!
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?
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'];
}
}
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!
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.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.