Image Upload and Resize Trigger Order Question

Hello All,
I do enjoy and like using the ADDT, however I do have a problem with the Image Upload and Resize trigger.
I understand that this trigger is of the AFTER type, and as such, the insert record I have on the page is implemented first and the data is inserted into the table, then images uploaded provided they are smaller than 200 kB in size.
However, as I have a field that is unique in the database, if the upload fails I am unable to upload any files which are under the size and put that information into the database, as there is already a record with the unique value.
Is there an easy way to work around this by trying to capture the error before the data is inserted into the database?
An idea I have is to: check the unique field with the value to be inserted, if fails, change unique value -> nothing inserted yet, no files uploaded.
If the unique check passes, insert remaining data and trigger the upload and resize image trigger, once that is complete, have an update of the table to update with the unique value.
I can see the above working, (I think), but I just have to write the code to implement the idea.
I am not sure how to use the roll-back triggers either, if the Upload Image trigger fails, to remove the inserted record.  But if I can manage the roll-back trigger to remove the record, that is an option to consider for what I want to achieve.
Thanks to any help people can provide.
Cheers,
Ian.

Thank you for your reply.
I have a work-around, I have split the forms over two pages, rather than put everything on one page - which introduced another issue, to which I have made a work-around of sorts too.
The two forms, on different pages, is probably a better idea in terms of better management of data input. The work-around was a Header redirect based on a form variable, as, if I used a Custom Trigger to dynamically generate a new URL, it generated an escaped-encoded URL - to which I have not figured out how to fix.
So, in the meantime, it works, so I will settle for that at the moment.
Again, thanks for you reply.
Ian.

Similar Messages

  • Upload and Resize Image not inserting filename in database

    I have a form that I created using the insert record form wizard. One of the fields is a file field and my form enctype is set to multipart/form-data. I then used the upload and resize image behavior and set the parameters. When testing the form the file uploads to the correct directory but no entry is made into the database for that particular field. The other fields are entered into the database just fine. If it helps, here is the code generated before the  tag:
    <br />
    <br /><?php require_once('../../Connections/test.php'); ?>
    <br /><?php<br />// Load the common classes<br />require_once('../../includes/common/KT_common.php');<br /><br />// Load the tNG classes<br />require_once('../../includes/tng/tNG.inc.php');<br /><br />// Make a transaction dispatcher instance<br />$tNGs = new tNG_dispatcher("../../");<br /><br />// Make unified connection variable<br />$conn_test = new KT_connection($test, $database_test);<br /><br />// Start trigger<br />$formValidation = new tNG_FormValidation();<br />$tNGs->prepareValidation($formValidation);<br />// End trigger<br /><br />//start Trigger_ImageUpload trigger<br />//remove this line if you want to edit the code by hand <br />function Trigger_ImageUpload(&$tNG) {<br />  $uploadObj = new tNG_ImageUpload($tNG);<br />  $uploadObj->setFormFieldName("picture");<br />  $uploadObj->setDbFieldName("picture");<br />  $uploadObj->setFolder("../images/");<br />  $uploadObj->setResize("true", 120, 0);<br />  $uploadObj->setMaxSize(1500);<br />  $uploadObj->setAllowedExtensions("gif, jpg, jpe, jpeg, png, bmp");<br />  $uploadObj->setRename("auto");<br />  return $uploadObj->Execute();<br />}<br />//end Trigger_ImageUpload trigger<br /><br />// Make an insert transaction instance<br />$ins_team = new tNG_insert($conn_test);<br />$tNGs->addTransaction($ins_team);<br />// Register triggers<br />$ins_team->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert1");<br />$ins_team->registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, $formValidation);<br />$ins_team->registerTrigger("END", "Trigger_Default_Redirect", 99, "../team.php");<br />$ins_team->registerTrigger("AFTER", "Trigger_ImageUpload", 97);<br />// Add columns<br />$ins_team->setTable("team");<br />$ins_team->addColumn("id", "NUMERIC_TYPE", "POST", "id");<br />$ins_team->addColumn("sort", "NUMERIC_TYPE", "POST", "sort");<br />$ins_team->addColumn("name", "STRING_TYPE", "POST", "name");<br />$ins_team->addColumn("title", "STRING_TYPE", "POST", "title");<br />$ins_team->addColumn("description", "STRING_TYPE", "POST", "description");<br />$ins_team->addColumn("picture", "FILE_TYPE", "FILES", "picture");<br />$ins_team->setPrimaryKey("id", "NUMERIC_TYPE");<br /><br />// Execute all the registered transactions<br />$tNGs->executeTransactions();<br /><br />// Get the transaction recordset<br />$rsteam = $tNGs->getRecordset("team");<br />$row_rsteam = mysql_fetch_assoc($rsteam);<br />$totalRows_rsteam = mysql_num_rows($rsteam);<br />?>

    If the reason is about memory, warning message should be happened when upload the image, because "show thumbnail" means resize at second time, how come you failed to resize the picture that system let it upload succeed at the first time by the same resize process?
    upload procedure
    a.jpg: 2722x1814, 1.2mb
    upload condition: fixed width 330px, 1.5mb
    "upload and resize" a.jpg -> file upload -> "resize engine" -> passed (but not work and no warning message)
    "show thumbnail" a.jpg -> "resize engine" -> failed (not enough memory)
    it doesn't make sense.
    and you miss an important key point, I upload the same picture myself, and resize work, so I said it happened at random, and that's why I am so worried.

  • Upload and resize issue

    Hi,
    I'm having a very strange issue with Upload and resize, using Imagemagik as library. I usually use "Proportional - Fixed with", with the width I need. But the upload page gives me this error:
    Notice: Use of undefined constant height - assumed 'height' in /home/webadmin/mydomain.com/html/includes/common/lib/image/KT_Image.class.php on line 338
    The upload is configured as this:
    function Trigger_ImageUpload(&$tNG) {
    $uploadObj = new tNG_ImageUpload($tNG);
    $uploadObj->setFormFieldName("imagen_pob");
    $uploadObj->setDbFieldName("imagen_pob");
    $uploadObj->setFolder("../poblaciones/");
    $uploadObj->setResize("true", 800, 0);
    $uploadObj->setMaxSize(2500);
    $uploadObj->setAllowedExtensions("gif, jpg, jpe, jpeg, png");
    $uploadObj->setRename("custom");
    $uploadObj->setRenameRule("{id_pob}.{KT_ext}");
    return $uploadObj->Execute();
    Are you having issues with this trigger?
    Thank you,
    Ruben
    Edit: If I use GD the error is this one
    Fatal error: Allowed memory size of 25165824 bytes exhausted (tried to allocate 16432 bytes) in /home/webadmin/mydomain.com/html/includes/common/lib/image/KT_Image.class.php on line 1774
    There is no room for just 16432 bytes?

    Thanks for your reply.
    So if I understand the script works fine on one server (memorylimit 120mB) but not the other (memorylimit 20 or 24 mB)?
    That is the difference. Now I have made a restriction on both the size (kB) and max height/max width. That gives the opportunity to upload images of up to 1.2 mB and maxHeight/Width of 2300 pixels (memorylimit of  20 mB). The figures were found by trial and error.
    Well sounds like a server issue. Is the new server php-cgi or apache mod php?
    I don't know but I will have a look (Probably apache). Out of curiosity- will there be a difference?
    Have you tried making a .htaccess file with php commands to control memory needed?
    Yes and it didn't work - either I have made an error or the host have found out that many people due to still larger imagefiles do their best to bypass these memory limitations
    I am currently looking into som javascripts (FLEX (found one in the ADOBE forum that may be able to do the trick) /FLASH may also be a possibility). Hoping to find a way to resize on the client and upload the reduced image to the host in one go. Many customers requests such a feature.
    Thanks for your help.

  • Photoshop CC: Have a template that I moved image into.  Image is too small.  How do I resize the image while in the template?  Or must I go to original image file and resize there again and again until I get the right fit?

    I have a template that I am able to plug different pictures into at different times.  The problem is that when I plug an image into that template, I find that the image is either too big or too small.  Is there a way to plug the image into the template and resize the image (and not the template itself) OR will I have to go to the file with the original image and resize it there and then try to plug it in to the template to see if it fits------and if it does not fit, go back to the original file with the image and resize it again and see if that fits---and so on and so on...........?  I have tried the" image size" option but it's hit or miss------mostly miss!
    Thanks!

    Read up on Smart Objects. It looks like you have no idea as to how to create and use them.
    Jut create a Smart Object from the layer containing whatever it image it is that you are "plugging into your template".  But you do need to learn the application at its most basic levels.
    Photoshop is a professional level application that makes no apologies for its very long and steep learning curve.  You cannot learn Photoshop in a forum, one question at a time.
    Or is it possible that you don't even have Photoshop proper but the stripped-down Photoshop Elements?"
    If the latter is the case, you're in the wrong forum.  This is not the Elements forum.
    Here's the link to the forum you would want if you're working in Elements.:
    https://forums.adobe.com/community/photoshop_elements/content
    If you do have Photoshop proper, please provide the exact version number of that application and of your OS.
    (edited for clarification)

  • Multiple Image Upload and watermarking

    Hi,
    I am using a gallery script which takes main images from a dynamic folder and creates thumbnails on the fly.
    It gets the main images dynamically from
    $config['fulls'] = $_GET['imgfolder_id'];
    Then GD is applied to create thumbnails on the fly. There is no GD role for the main images. I use lightbox to show pop-up image. And the images are uploaded to a dynamic folder using ADDT multiple image upload server behavior.
    My requirement: want to apply water mark on the large (pop-up) image. Not on the thumbnail.
    Is it possible to have the water mark applied at the time of Multiple Image Upload?
    Thanks for any help
    Jay

    Hi Jay,
    if it were a single image upload, I would have suggested to apply a PHP watermark script to the uploaded image by embedding that code in a Custom Trigger, type AFTER -- but as the multiple upload gets proceeded by a flash file, I have no clue how to do that.
    Cheers,
    Günter Schenk
    Adobe Community Expert, Dreamweaver

  • Batch Image convert and resize

    Hello,
    quick question i have about 2000 images in the NEF Format!
    I need to convert them to PNGs or JPEGs and resize them.
    Is there a good tool for that? Anything Besides PS Droplets?
    Thank you

    Me too. GC has batch conversion features not found anywhere else, and supports every known image format.

  • Need help with image upload and preview display

    hi guys,
    I'm trying to upload image and then display it as a preview, but when upload form submits to the same page image placeholder does not refreshes it's source and displays the same image as before.
    Image 4.jpg already exists.
    I upload it with nameConflict = "overwrite"
    upload form points to the same page, therefore page reloads
    In IE image placeholder does not display the new image, but shows the old one until I refresh the page with F5 and resend information, however if checked, image in the file is already different.
    In Firefox, sometimes it works and image refreshes, sometimes not.
    any help would be greatly appreciated!
    cheers,
    Simon

    Hi Daverms,
    With your code you suggest to not only upload the image but make a database entry too. However my intention is to firstly upload the file, and show a preview. Then if user is satisfied with what he sees, he presses "aprove" button and therefore makes a datase entry. Then the photo number will increase by one.
    Until user is not aproving the photo he can upload any image again and again, but the new image will be always given the same name (example 4.jpg) and overwriting the old one.
    I believe the problem persists because browsers are loading image with the same name from the cache, and not from the actual location. Therefore when I refresh the page it catches the correct image.
    If I follow your code, every time I upload the image, name of it is different, therefore browser cannot find it in the cache and is forced to load one from the server.
    I wonder is there any way to avoid this cache problem?
    cheers,
    Simon

  • Image upload and display from database blob coloumn in ADF

    HI
    how can i upload and display image from database ( blob ) coloumn in ADF

    Hi,
    Take a look to this video: http://www.youtube.com/watch?v=_KYquJwYFGE
    AP

  • Limit the filesize upload and resize a blob image in a report

    I'd like to know how to do both.. I have a file browse that uploads images to my application. It's called P34_IMG1. I would like to limit the file dimensions to a maximum of 200 x 300 px (but it can be less) and have a limit of 1MB in filesize.
    As well as the above, I'd like to know how to resize this image into a 'thumbnail' of sorts that shows the image much smaller in a report. The image shows but they are too big. How do I resize them?
    Thanks much
    -J

    oh I didn't see this reply, Tony. Sorry.
    No I don't have the image like that in the report, the report's query is like this:
    select * from (
    select      "LOTS"."LOTID" as "LOTID",
          "LOTS"."LOTNAME" as "LOTNAME",
          "LOTS"."ADD1" as "ADD1",
          "LOTS"."ADD2" as "ADD2",
          "LOTS"."ADD3" as "ADD3",
          "LOTS"."COUNTRY" as "COUNTRY",
          "LOTS"."MESSAGE" as "MESSAGE",
          "LOTS"."APPSTATUS" as "APPSTATUS",
          "LOTS"."SENDERMESSAGE" as "SENDERMESSAGE",
          "USERS"."USERNAME" as "USERNAME",
             dbms_lob.getlength("IMG1") as "IMG1"
    from      "USERS" "USERS",
          "LOTS" "LOTS"
    where   "LOTS"."USERID"="USERS"."USERID" AND (UPPER("USERS"."USERNAME") = UPPER (:APP_USER)))
    where (
    instr(upper("APPSTATUS"),upper(nvl(:P40_SEARCH,"APPSTATUS"))) > 0
    )and the IMG1 column in the report attributes has the number/date format as IMAGE:LOTS:IMG1:LOTID::::::inline:Download. So I don't know how to use this to resize the images, unfortunately.

  • Image uploading and saving to database

    hi ,
               I am developing application for summer placement . i want to upload image with candidate's details and save it to database. How to do this? I hv got tutorials for uploading image but want to know how to save it to database table along with  candidate's details.
    Kavita

    Hi kavita,
                   In Webdynpro u r using attribute of type Resource ,which is binded to FileUpload UI element. From this attribute, u get file in Input stream format which can be converted into byte array like this
    byte fileData[] = null;
          try{
                InputStream fileIs = wdContext.currentFile().getFileData().read(false);
                ByteArrayOutputStream bOut = new ByteArrayOutputStream();
                int length;
                byte[] part = new byte[10 * 1024];
                while ((length = fileIs.read(part)) != -1) {
                      bOut.write(part, 0, length);
                fileIs.close();
                fileData = bOut.toByteArray();
                bOut.close();
          } catch (Exception e) {
                wdComponentAPI.getMessageManager().reportSuccess(e.toString());
    In webservice u can take a the byte array as input parameter where the uploaded file will be passed as byte array .
    In DB u can store it as BLOB .
    in case of any other doubt u can revert back to me.
    regards
    Sumit

  • Images rotate and resize when relinking after collect for output

    I just started using CS5 and have run into an issue that is very disturbing to me. When I relink my files from the collected folder that I send to printer, images that have been rotated in Indesign rotate to their actual size and rotation. This is not a good thing! We should not have to rotate all of our images outside of indesign.. Please Help!!!

    OK, we were cross posting, and I've now looked at your file.
    One key piece of information you didn't tell us before is that the file was created in CS3 and converted. There are a lot of reports of strange behavior with legacy files. This one seems to be somewhat corrupt at this point. I don't know how much of that was introduced form the conversion, and how much from the previous recycling.
    The best approach when converting a CS3 file is often to export as .inx from CS3 and open that in CS5. The other thing that helps is to open the old file iin CS5, then immediately export to .idml, then open that and save as a new .indd and work with that. Since I don't have the original CS3 version I don't know how that behaved or if .inx will help, but exporting this one to .idml seems to clear up problems with all the photos except the one at the top of page 4 which rotates 180 degrees when relinked.
    For best results you should probably rebuild this file from scratch in CS5, then save as a template. Starting each new editon from a template is more reliable than resaving an old issue and removing unwanted content. Although ID is more stable than most programs when you do this, creeping corruption is always a problem with long-term resaving of the same document and you often don't see it until you are hard up on deadline and your file goes south.

  • Image upload / resize in "Update Record" form?

    Hi
    I've created a form to add products to a database, it includes an image field using the "upload and resize image" behavior. This works fine.
    But now I'm building the uèpdate form and want to offer users the possibility of either retaining the current file, uploading a new image to the server (and delete/overwrite the previous one if it exists) or delete the current image without uploading a new one.
    how would i go about this?
    thanks.

    Hi Waleed,
    oops, yes, sorry, you´re right of course -- just didn´t read it too carefully :-)
    However, what Somaboy and Dave want, is a little different from what the tutorial explains at this point -- what´s explained there, will of course be deleting that image physically and erasing the file name entry from the table, but that won´t cover the requirement to additionally upload another picture from the same form.
    In this special case I *think* that one would have to perform both deletion processes as "before" triggers -- to make sure that the file as such plus the corresponding table entry are really gone before the upload procedure happens.
    If someone will ever find out a well-working strategy to get this
    (BTW very often asked for) requirement done, many folks here would certainly jump for joy -- also because that´s something you apparently can´t do without implementing a chain of at least custom triggers.
    But there´s also a much easier solution available to those folks who don´t want to bother with implementing custom triggers for this purpose alone :: this is how I´d do it:
    1. use what´s described in step 3 of the tutorial you posted to delete the physical file and the "filename" column entry
    2. pass the current recordset´s ID to the "redirect after update" page, and here...
    3. add a "SELECT file_column FROM table_name WHERE ID" matches the URL parameter ID - query in order to check if this column is empty or not -- and if it´s empty, execute an "upload and resize image" behavior on this page.
    Cheers,
    Günter Schenk
    Adobe Community Expert, Dreamweaver

  • Multiple Image Uploading Question

    Please forgive my ignorance here but I saw the question on multiple image uploading and this is something i have been trying to do for a few days now without any success.
    I am using CS3 with ADDT and PHP
    I want to allow my users to be able to upload say 5 pictures at a time, each user has multiple photo albums the names of which are stored in mysql table, the image name is stored in a different table with a reference to the album id.
    So, I assume that i put an insert record on the page, I followed the usual process used to have a single image upload and thought it would give me or add the extra file field options on the form when telling the multi upload to allow 5 images to be uploaded, not the case. Do i have to create a form on the page first with 5 file fields or am i just missing the plot here.
    Sorry if this is just something that seems simple but i just don't seem to be able to get it to work at all. I have no working example to look over and have serach google to see if there are any tutorials for doing this but can't find any at all.
    Thank you in advance of any help and guidance given
    Regards
    Ray

    Hi Günter
    Thank you for your reply and also for the great tutorial site you run which has helped me quite a lot with several things.
    ok, so i am maybe a little confused here, so what is the multiple image uploader for if not for uploading multiple images, and how does it give you the option to select more than one file or is it that you can't use it when inserting the image file into a database?
    Please forgive my ignornace again, i can see when i have tried using the multiple image upload thatit puts a text link called upload, what is that for because it doesn't seem to do anything on the page i have tried it on?
    Kind Regards
    Ray

  • Resizing images - portrait and landscape

    Hi,
    I am uploading and resizing images(see code), I want to
    resize them to 200px by 150px if landscape and 150px by 200px if
    portrait. How can I determine the orientation of the image?

    Well, first of all you would need to know what the initial
    image dimensions are. And the way to do this is to get the current
    images height and width from reading the image. You would then
    compare the width number to the height number and if the width is
    greater than the height, you know that it's more of a landscape
    photo...and vice versa.
    Try this code:
    <cfimage action="read"
    source="#expandPath("graphics/corner.png")#" name="myImage" />
    <cfdump var="#variables.myImage#" />
    <cfif variables.myImage.width gt
    variables.myImage.height>
    Landscape
    <cfelseif variables.myImage.width lt
    variables.myImage.height>
    Portrait
    <cfelseif variables.myImage.width eq
    variables.myImage.height>
    Square
    <cfelse>
    Something else for whatever reason.
    </cfif>
    At least, I think this is how you'd do it. I know it's not
    the most elegant way...you might want to look at ColdFusion image
    functions rather than reading the whole image in, I think there are
    functions just to get width and height, which I imagine should give
    you better performance.
    Good luck,
    Mikey.

  • Multiple image upload CRASH!!! but works with simple image upload

    I'm getting MAD.
    I'm using php and GD
    While the simple image and re size works like a charm, the multiple image upload or the multiple file upload have a strange behavior.
    It opens the pop-up with flash, then eventually shows me files or thumbnails but when I try to up load I just wait and get the typical "system becoming unstable" flash error.
    As I can see the directory is always generated (I've tried also to put a static directory) but after stargin the upload the flash uploader just crashes and no result.
    Any help would be really appreciated

    Hi Fonzie,
    as the folder is getting created, the issue you´re having is not related to wrong folder permission - it´s something else...
    As I wrote before, che common upload and resize function works perfectly
    this one works perfectly, because it´s just one file to upload and to process, wheras doing that with multiple files might collide with some settings on your server
    So for sure it's not a simple issue as the max filesize
    Are you sure ? Did you check the current "max_upload_filesize" setting ? As long you don´t check it, you can´t know :-)
    As a general rule of thumb, it´s important to be aware of the fact that uploading & resizing images on the server might collide with several PHP settings -- and the more images you upload and resize in one swoop, the closer you´re getting to these limits respectively might even be exceeding them. The following "directives" are those which have an effect on whether your image/file upload & processing will work or not:
    - "max_upload_filesize" :: is sometimes set to just 8 MB on a shared hosting, sometimes 16 MB, sometimes more. This setting will affect the file upload procedure only
    - "set_time_limit" (e.g. 30 seconds) :: if the execution time of a script exceeds this limit for whatever reason, the server simply shuts it down without letting you (respectively the flash uploader) know it´s been shut down. This *might* be the reason why ADDT´s flash uploader hangs respectively returns that error message after some time, because it´s waiting for some response from the server which never comes.
    - "memory_limit" (e.g. 8 MB) :: this directive is a sort of "allocated server RAM" for your account, and it´s in particular the image resizing process which will grab more or less memory resources -- the higher the the resizing factor is, the more RAM is spent, and the more images are getting resized in one swoop, the worser it gets.
    However, all these PHP directives can be changed, and your host might even be so courteous to increase the currently defined values of those abovementioned directives for you -- and that´s what I´m suggesting at this point.
    Cheers
    Günter Schenk
    Adobe Community Expert, Dreamweaver

Maybe you are looking for