{images}{/images} I got from the Mark Huot instructions on his website. I admit they were a little confusing:
Template Tags
{images backspace="6"}
{if file_path}{file_path}
{/if}
{if file_thumb_path}{file_thumb_path}
{/if}
{/images}
{upload_picture} is the actual FILE field, and {picture_caption} is just a custom field that will hold text. So what I am getting when I view the published page is that it displays the string of the image instead of the image itself.
I have tried doing what you have said:
{exp:weblog:entries weblog="photo_gallery"}
{upload_picture backspace="6"}
{if file_path}{file_path}
{/if}
{if file_thumb_path}{file_thumb_path}
{/if}
{/upload_picture}
{picture_caption}
{/exp:weblog:entries}
When I publish the page I get nothing
Using the file extension I am coming across an issue where the resized file is resizing ok but taking the incorrect MIME type. So I’ve got a .jpg file with a MIME type of GIF. I’ve run a few tests and any image file uploaded gets the MIME type of GIF.
Just came across your post after running into the same problem. I mostly upload jpegs and I found that popping the jpeg if() clause to the top of the chain fixed this problem.
on line 915:
if(($src_img = @imagecreatefromjpeg($server_path.$file_name)) !== FALSE) {}
else if(($src_img = @imagecreatefromgif($server_path.$file_name)) !== FALSE) {}
else if(($src_img = @imagecreatefrompng($server_path.$file_name)) !== FALSE) {}
and on line 1030 (I think this is the culprit):
if(@imagejpeg($dst_img, $dst) !== false) {}
else if(@imagegif($dst_img, $dst) !== false) {}
else if(@imagepng($dst_img, $dst) !== false) {}
I’ve not tested this with other filetypes, so you might end up uploading GIFs/PNGs that end up with jpeg MIMES, but at least it’s a start!
Also, I found that the jpeg resizing was reducing the quality of the image too much as the default is 75%. The imagejpeg function has an optional quality setting for jpegs, so I added this to line 1029:
if(@imagejpeg($dst_img, $dst, 100) !== false) {};
…and now a question, rather than an answer! I’ve not seen a response to this in the forums, but apologies if I’ve missed something.
If I try to add a large image (over 3mb), the memory times out and I get the ‘white screen of death’ (which someone so aptly described somewhere else).
I’ve got the maximum file size set to 2097152 bytes (2mb) in the file upload settings, but the file size doesn’t seem to be getting caught early enough in the proceedings? Any suggestions of getting an error message to show up rather than the system freezing? I tried uploading the file using the first party upload button, and this catches the problem in time.
Any help much appreciated!
I need to see a real-world working example of template tags for Mark Huot’s File extension.
I have successfully uploaded an image with the extension, and verified that the file is on the server. The name of the custom File field is “news_image_1”. Here’s my template code:
{exp:weblog:entries}
{body}
{news_image_1 backspace="6"} {if file_path}{file_path} {/if} {if file_thumb_path}{file_thumb_path} {/if} {/news_image_1}
{/exp:weblog:entries}
I get the title and body fields outputted fine, but nothing else at all. The “File” template tags are right from the extensions docs. Any idea what’s wrong? EE 1.6.4, PHP 5.2.6. Thanks.
Now to my problem. :coolsmile:
Images uploaded are being converted from nice pretty jpegs to crunchy gifs, making them HUGE files and ugly. The dimensions also seem to be
I don’t get it.
Here’s an image I uploaded…
http://dev.conary.org/images/bighead.jpg
And this is what was generated on the server.
http://dev.conary.org/images/uploads/bighead1.jpg
Note that it’s both being resized to the maximum image size set in the upload prefs and that it is now a GIF. It ballooned from 216k to nearly 3mb in the process.
Ideas?!!??
How come you “took it off the thread”? I’m having the same problem (no output) and would have liked to hear the answer you gave.
This thread is already 38 pages, and I didn’t think having essentially a 1-on-1 conversation in it was helping the whole community anymore. The person was using the extension incorrectly–it wasn’t a problem with the extension. Just trying to keep the thread as clean as possible.
Did scottmoa’s post help?
Scottmoa:
Images uploaded are being converted from nice pretty jpegs to crunchy gifs, making them HUGE files and ugly.
Does making the following change in the extension code help?
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) {}
Regarding the length of this forum topic: This is what Mark Huot gives as the “support” link in his docs for the File extension. So obviously his original intention was to keep the whole discussion here. I completely agree that it’s unwieldy at this point. Mark should handle support a different way, but apparently he’s not supporting the extension anymore at all – as evidenced by his absence from the discussion of the JPEG mangling bug; a bit more on that below.
I was getting no output because I wasn’t wrapping his “custom field” tag in an HTML image tag. But his docs don’t say to do that, and I’m not a mind reader about what someone’s code does and doesn’t do. So, if you want an image to appear, you need an HTML image tag. However, if you’re using the “File” extension to allow the upload of ALL file types, not just images, then obviously you DON’T want to wrap your “File” field tag in an image tag. But I’m not dealing with that scenario here.
Here’s what works if you’re just trying to upload and resize an image, and then use it in a posting – which probably covers 90% of people. In this example, my weblog is named “news” and my custom “File” field is named “news_images”. If you have your “File” field set to allow multiple uploads, the following code will output all of them; if not, it will just output the single image you’ve allowed people to upload. Obviously, in addition to the HTML image tag I have here, you’ll do HTML for other fields (like title and body) and you’ll handle your CSS any way you want (I have inline CSS for this example):
{exp:weblog:entries weblog="news"}
{news_images}
<img src={file_url} style="float: right; margin: 10px 20px; border: none;" />
{/news_images}
{/exp:weblog:entries}
(BTW, to make this Forum post work, I had to use HTML entities for the left and right angle brackets of the image tag in the code above, otherwise my img src and the contained {file_url} wouldn’t show up; can’t that be fixed in these Forums?)
If, in Admin > Weblog Administration > File Upload Preferences (where you define your special upload destination), you have “Keep Original” set to “yes”, then you need to use {file_thumb_url} in the image tag above, NOT {file_url} because {file_url} will be for the original uploaded (and possibly gigantic) image file and {file_thumb_url} will be for the resized version that the “File” extension creates upon upload.
Regarding the bug where the “File” extension turns JPEGs into nasty GIFs masquerading as JPEGs: the bug is definitely there in “File” extension v.3.1.1, and the fix here works. Here’s another thread from these Forums where it’s also mentioned that you can control the quality of JPEG created:
Hi @ all
and
cheers
1) What exactly are you doing with jQuery that’s intefering? The mere inclusion of the jQuery framework (with a script tag in your page head) should not be doing anything to the display of those checkboxes.
2) I see no capability in the “File” extension itself for this. For single images only, you could easily define an additional field in your field group, put the caption there, and then bring that field in with your HTML. If you’re using the extension for multiple file upload, I see no obvious captioning solution. Anyone else?
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.