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

Simon Rudkin's avatar
Simon Rudkin
51 posts
16 years ago
Simon Rudkin's avatar Simon Rudkin
How do you dynamically access a thumbnail of an uploaded image? As it is right now it just sticks in a URL to the original image, but I see no way to get it to output the URL to the thumb?

Any news on a neat way to approach this (that isn’t clunky and problematic, like what I’ve come up with…)!

       
liquilife's avatar
liquilife
147 posts
about 16 years ago
liquilife's avatar liquilife

Simon, I think I’ve found a fairly stable way around this. Someone earlier in this thread mentioned a php script called PHPThumb (http://phpthumb.sourceforge.net/). This and a bit of creative HTML has allowed me to achieve what I need. Take a look at http://www.unclegamer.com/news/discuss/microsoft_officially_announces_xbox_360_elite/ to see an example page of how the File extension and PHPThumb together has allowed me to list off unlimited rows of thumbnails with a link to the original image. I could even have linked it to another size limited image.

While it works great I still haven’t achieved quite what I want. The divine solution would allow me to click the thumbnail which would open a new HTML page with that image embedded, allowing me to stick an advertisement, or anything for that matter, above and/or below the image. Even better would be prev/next links to cycle through all images associated with the entry. This solution only allows me to link up a thumbnail directly to the image.

       
johnhopkins's avatar
johnhopkins
9 posts
about 16 years ago
johnhopkins's avatar johnhopkins

Ok, I’ve never installed an extension. How do I do it?

++Nevermind++

       
zitro62's avatar
zitro62
9 posts
15 years ago
zitro62's avatar zitro62

I’m quite new to EE so please bear with me…

I can’t seem to find any documentation on this extension and I think this is something that I’m interested in.

I’m trying to find a way to insert up to 3 images on a weblog post as well as possibly a link to a pdf file. I know I can do this with html and my FTP program, but getting my client to be able to do this is key! thats why this extension seems to be pretty appealing.

so how can I insert image1, image2, image3, and pdf1 all in various places through out my weblog post? I’ve named my custom field “file_upload”

Thanks for the help with the code!

       
Mark Huot's avatar
Mark Huot
587 posts
15 years ago
Mark Huot's avatar Mark Huot

zitro62, I’d try using four different fields. three for the images and one for the pdf. then you can just call those fields in the template as you would any other field.

       
zitro62's avatar
zitro62
9 posts
15 years ago
zitro62's avatar zitro62

Wow thanks for the super fast response… I think your solution will certainly work.

2 questions though:

  • If I use the multi-file upload solution your plug-in provides is it only for images?
  • How do i take advantage the thumbnail feature

Thanks again for the help

—- EDIT —- I’ve found a good solution to my problems, but now how do i only list my file names if I’m using the multi list feature.

{file_uploads}
<a href="http://{file_upload}">{file_upload}</a>
{/file_uploads}

This my files great, but the text that is linked is the entire uri. Is there any way to only display the pdf or doc file name only?

       
mhulse's avatar
mhulse
329 posts
15 years ago
mhulse's avatar mhulse

Great extension! In fact, all of your extensions have been extremely helpful. 😊

Many many thanks!

Just have a quick thought on this extension… I hope I am not way out of line or off-base on this one:

Seems like this would be totally perfect if you could change settings based on the folder uploaded… Kinda like how EE has the option to Create New Upload Destination (see “Main Screen”.) Then, per upload destination, one can set variables specifically for that upload folder.

For example, I would like to have a couple (thumb) images per blog post that get sized differently… The thumb images uploaded to “index” would get resized to 100x100px, and the thumb images that get uploaded to “articles” get resized to 250x300px…

Just a thought… Either way, perfect addition to EE. Many thanks! 😊

Cheers, Micky

       
Mark Huot's avatar
Mark Huot
587 posts
15 years ago
Mark Huot's avatar Mark Huot

@zitro62: that would have to be done with a simple PHP regular expression running on “Output”

@Wild Garden: You most certainly can have different settings per field. As you alluded to just set up different upload destinations and then when creating the field choose those upload destinations. If you’re going to go this route, just be sure to clear out all your “Extension Settings” because those will override any per-field Upload Destination settings you may have set.

       
mhulse's avatar
mhulse
329 posts
15 years ago
mhulse's avatar mhulse
This extension is great. Just what I have been looking for! I’ve got a question though. How do you dynamically access a thumbnail of an uploaded image? As it is right now it just sticks in a URL to the original image, but I see no way to get it to output the URL to the thumb?

This is my quick/dirty approach for a single upload:

<?php
    $cust = '{article_image}'; // Name of custom field.
    # pathinfo might work better if using PHP 5.2.0
    # http://www.php.net/manual/en/function.pathinfo.php
    //$file_name = pathinfo($cust); echo $file_name['filename'];
    $path_to_files = dirname($cust); // Path to file.
    $parts = explode('.', basename($cust));
    # $parts[0]; // file_name
    # $parts[1]; // .ext
    echo $path_to_files.'/'.$parts[0].'_t.'.$parts[1];
    # Output:
    # <img src="http://www.site.com/images/articles/red-lilly_1_t.jpg" alt=""  />
?>
I think this would be great so my authors could attach multiple images to any posting and it would just append a series of thumbnails that can be clicked through to the full sized image. What would be the best way of going about this?

You could use the built-in extension code “{images}..{image}..{/images}” to loop and use something like the above code (might be best to convert it to a function) to generate your links… But, keep in mind, I just discovered this extension an hour ago, and I have been up all night, so maybe there is an easier way to get the thumb. 😊

@Wild Garden: You most certainly can have different settings per field. As you alluded to just set up different upload destinations and then when creating the field choose those upload destinations. If you’re going to go this route, just be sure to clear out all your “Extension Settings” because those will override any per-field Upload Destination settings you may have set.

Thanks for the quick reply Mark! I really appreciate the help. 😊

O.k., I need some zzZZzz’s.

Cheers, M

       
funnEE's avatar
funnEE
94 posts
15 years ago
funnEE's avatar funnEE

Dear Mark, Thanks so much for the great extension. Little help please, I would like to remove the URL and just leave the file name for non images in templates. Is this possible? Thanks, D

       
Mark Huot's avatar
Mark Huot
587 posts
15 years ago
Mark Huot's avatar Mark Huot

unfortunately d3453 that is not possible without the use of PHP parsing set to output. you could do it though by just using a php preg_replace to isolate the filename.

       
mhulse's avatar
mhulse
329 posts
15 years ago
mhulse's avatar mhulse
I would like to remove the URL and just leave the file name for non images in templates.

$parts[0]; // file_name

From my last post… But maybe there is a better/faster PHP solution. 😊

       
Mark Huot's avatar
Mark Huot
587 posts
15 years ago
Mark Huot's avatar Mark Huot

try something like this:

<?php
    $cust = '{article_image}'; // Name of custom field.
    $filename = basename($cust); // name of file with extension.
    $parts = explode('.', $filename); // array of file name
    # $parts[0]; // file_name
    # $parts[1]; // ext
    echo $parts[0]; // just the file name without the ext.
?>
       
funnEE's avatar
funnEE
94 posts
15 years ago
funnEE's avatar funnEE

Mark, thank you so much for this great script. I am running into two problems, my fault of course. 1st, I tried using the two arrays as mentioned above but I get a blank screen. I have enabled php in the template. What I would like to do is like the following:

{if attach}
{attachs}
<a href="http://{exp:download_lock:link">Download</a>
{/attachs}
{/if}

2nd, I am having troubles with the SAEF. I copied and pasted from the publish html source and the js. The form seems to work, it enters a title, but in the exp_weblogs_data table, nothing is entered. When I remove the tag below, it works. It also works just fine when I use the CP. Below is the code I have in the template: 1st js in the head, I have only added the function addRow and second in the body:



Thanks for everything you do. Dave

       
mhulse's avatar
mhulse
329 posts
15 years ago
mhulse's avatar mhulse
but I get a blank screen.

Do you have PHP error messages turned on?

       
First 7 8 9 10 11 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.