| geoman | -- 03-21-2004 @ 4:37 AM |
|
Hi there, i'm kinda new to this forum and consequently to ColdFusion itself so if i'm asking something stupid please forgive me. I'm trying to build a server side coded site and really liked cold fusion. It's great, i'm really doing well. My questions is: I heard that there is a way to upload a picture to the server, and it doesn't matter how big it is, it auto resizes the picture to the pre-defined size and pixels. For example if i'm trying to upload a picture of 25mb 1000x1000pixels to the server, it automatically resizes it to the dimensions i have defined(for the sake of the example let's say 150x100px and 6kb size) and then uploads the picture. Also it auto-enters the name of the picture file to the database and outputs in a field the url name which directs to the file on the srver. Does anybody know how this is done, and if there is a tutorial so we could learn it also. Thank you in advance You can fool some of the people for some time, and all people for some time, and some people for all time. You can't though fool all people, all time.
|
|
| Webmaster | -- 03-21-2004 @ 10:27 AM |
|
There are many ways to achieve this... Here are a couple: http://www.cfdev.com/products/productdetail.cfm/id/6 http://www.efflare.com/products/cfx_imagecr/ Thanks, Pablo Varando Team Macromedia Member =====================================================
|
|
| geoman | -- 03-22-2004 @ 11:05 AM |
|
thank you for replying. i've visited these sites but i can not find tutorials on how to do the actual script. the only thing i can find is a ready program that does what i want, and i'm sure i won't be able to understand it. You can fool some of the people for some time, and all people for some time, and some people for all time. You can't though fool all people, all time.
|
|
| Webmaster | -- 03-22-2004 @ 11:48 AM |
ok, so what exactly is your question? Thanks, Pablo Varando Team Macromedia Member =====================================================
|
|
| geoman | -- 03-23-2004 @ 5:49 AM |
|
my question is , if there is a tutorial which actually describes how someone could do the script which autoresizes images in coldfusion on his own. :) thank you again, You can fool some of the people for some time, and all people for some time, and some people for all time. You can't though fool all people, all time.
|
|
| apletfx | -- 03-30-2004 @ 12:42 AM |
|
There used to be one at one time... Must have been deleated at the authors request. I have been using some code that I have pieced together from tutorials here. I will work something up and upload it in the next few days. It usesCFDev's AutoResize tag so you need to have it installed first. So do that first and then check back for a tut on how to make it work. Mark Aplet http://www.pixeljunkie.org
|
|
| apletfx | -- 04-01-2004 @ 12:27 AM |
|
Here is a "in a nutshell" version for you. Application.cfm <!--- // SETS THE NUMBER OF TABLE COLUMNS // ---> <cfset columndisplay=4> <!--- // SET THE NUMBER OF IMAGES TO DISPLAY PER PAGE // ---> <cfset DisplayAmt=20> <!--- // ENABLE CLIENT VARIABLES FOR THE SITE---> <CFSCRIPT> dsn = "YOUR DSN"; // Sets The DATASOURCE for all pages. thumb = "http://YOURDOMAIN.COM/thumbs"; // default URL of Thumbnails full = "http://YOURDOMAIN.COM/full"; // default URL of Full Images thumbpath = "D:\PATH TO YOUR DIRECTORY\thumbs\"; // default Physical Location of Thumbnails fullpath = "D:\PATH TO YOUR DIRECTORY\full\"; //default Physical Location of Full Images </CFSCRIPT> Upload_select.cfm <form action="photo_upload.cfm" method="post" enctype="multipart/form-data" name="file" id="file"> <input name="Photo" type="file" id="Photo" size="50"> <input type="submit" name="Submit" value="Continue"> </form> photo_upload.cfm <cfif IsDefined ("FORM.Photo")> <!--- Upload selected file to both the full and thumbs Directory ---> <CFFILE ACTION="upload" FILEFIELD="photo" DESTINATION="#fullpath#" NAMECONFLICT="makeunique"> <CFFILE ACTION="upload" FILEFIELD="photo" DESTINATION="#thumbpath#" NAMECONFLICT="makeunique"> <!--- Set variables to be used in the rest of the application ---> <CFSET filepath="#thumbpath#"> <CFSET file_to_thumbnail = "#filepath#\#file.serverfile#"> <CFSET thumb_filename = "#filepath#" & "\thumb_" & "#file.serverfile#"> <CFSET thumb_displaypath = "#thumb#" & "/thumb_" & "#file.serverfile#"> <!--- Change image size for the thumbnail and save another copy in the thumbs directory This action is produced with assistance from CFDev.com's Auto Resize CFX Tag ---> <CFX_AUTORESIZE ACTION="IML" FILE="#file_to_thumbnail#" COMMANDS=" setvar x=75 setvar y=75 resize <x> write #thumb_filename#"> <!--- // Deletes the extra copy of the image from the thumbs directory // ---> <CFFILE ACTION="DELETE" FILE="#filepath#\#file.serverfile#"> <!--- // NOW INSERT THE IMAGE PATHS INTO THE DATABASE // ---> <CFQUERY NAME DATASOURCE="#dsn#"> INSERT INTO MyPhotosTable(Thumbnail,Full_Image) VALUES('#thumb#/thumb_#file.serverfile#','#full#/#file.serverfile#') </CFQUERY> <cfelse> You did not upload a file... Please go back and try again. </cfif> Mark Aplet http://www.pixeljunkie.org
|
|
| EasyCFM.COM ColdFusion Forums : | http://www.easycfm.com/forums |
| Topic: | http://www.easycfm.com/forums/viewmessages.cfm?Forum=10&Topic=3323 |