PHP -Mysql image resize and upload

All,
Any good ideas, code out there to help me do a PHP MySQL image resize, uploade and display? Thanks for your help!

For upload image, u may look at the similar thread HERE

Similar Messages

  • Local image resize and upload

    Hi guys,
    I've been checking around the net for a way to implement the following:
    user wants to upload a large image. the image is resized locally on their computer to a 60kb small image. this image is then uploaded and used.
    Is there a way to do this with flash? or what is the best method? (NB: I'm not interested in using Java)
    thanks for any info or links.
    Jeff

    Well in short, you need a second language to support that,
    e.g. PHP/ASP/CF.
    First you'll have to build a GUi in which you can upload the
    jpg, putting it to the server using php/asp/cf, then you'll need to
    make a call to that image, (importing it into your flex), then
    you'll have to set the parameters for the resizing, then you'll
    have to call a php/asp/cf script which does te resizing

  • Image Resizer and Uploader

    I am new to Flex, and I have (so far) only developed two
    other applications using Flex.
    I am having a really difficult time with this issue. I've
    tried everything (except for creating a class) that I can think of
    to resolve this issue, and I'm running out of ideas.
    What I am trying to do is create an AIR application that
    takes the selected images and resizes them to a specified maximum
    height and width. It is resizing the image and saving it in a
    temporary spot, but it will not upload after it saves it. I keep
    receiving the error below:
    quote:
    Error #2044: Unhandled IOErrorEvent:. text=Error #2038: File
    I/O Error.
    at flash.filesystem::File/resolveComponents()
    at flash.filesystem::File/resolvePath()
    at ImageUploader/saveAndUploadImage()[C:\Documents and
    Settings\jgosselin\workspace\ImageUploader\src\ImageUploader.mxml:136]
    at ImageUploader/uploadButton_click()[C:\Documents and
    Settings\jgosselin\workspace\ImageUploader\src\ImageUploader.mxml:50]
    at ImageUploader/__uploadButton_click()[C:\Documents and
    Settings\jgosselin\workspace\ImageUploader\src\ImageUploader.mxml:213]
    My guess is that there is a lock on the file while it is
    being written and it tries to upload it before it closes. However,
    (as shown in the code) that is not the case. The error references
    to lines that has nothing to do with the line of code that is
    causing the issue. I have stepped through the code and it stops
    after the FileStream close event handler has been executed. What am
    I missing? What is it that I am not seeing? Has anyone developed
    something similar to this application? As shown in the code, I am
    using a series of events that triggers the next step of the
    process.
    EDIT: The code below is a scaled-down version of the
    application.

    Here is the code:
    quote:
    <?xml version="1.0" encoding="utf-8"?>
    <mx:WindowedApplication xmlns:mx="
    http://www.adobe.com/2006/mxml"
    xmlns:local="SmoothImage.as" layout="vertical" horizontalGap="0"
    verticalGap="0" paddingLeft="8" paddingRight="8" paddingTop="8"
    paddingBottom="8" width="640" height="480" xmlns:local1="*">
    <mx:Script>
    <![CDATA[
    import flash.events.OutputProgressEvent;
    import flash.events.ProgressEvent;
    import flash.filesystem.File;
    import flash.filesystem.FileStream;
    import flash.net.FileReference;
    import flash.net.URLRequest;
    import mx.collections.ArrayCollection;
    import mx.controls.Alert;
    import mx.graphics.codec.JPEGEncoder;
    [Bindable] private var filesFiltered:Array;
    private var maxImageWidth:Number = 640;
    private var maxImageHeight:Number = 480;
    private var tempFile:Array;
    private var currentFile:Number;
    private function uploadButton_click(event:Event):void
    tempFile = fileThumb.selectedItems;
    currentFile = 0;
    saveAndUploadImage(tempFile[currentFile]);
    private function
    uploadFile_progress(event:ProgressEvent):void
    var bytesUploaded:Number = event.bytesLoaded;
    var bytesTotal:Number = event.bytesTotal;
    uploadProgress.setProgress(bytesUploaded, bytesTotal);
    uploadProgress.label = "Uploaded: " +
    Math.round((bytesUploaded / bytesTotal) * 100) + "%";
    private function uploadFile_complete(event:Event):void
    uploadProgress.setProgress(0, 1);
    uploadProgress.label = "";
    if (currentFile + 1 < tempFile.length)
    currentFile++;
    saveAndUploadImage(tempFile[currentFile]);
    private function
    newFileStream_progress(event:OutputProgressEvent):void
    var bytesPending:Number = event.bytesPending;
    var bytesTotal:Number = event.bytesTotal;
    var percentage:Number = Math.round(100 - ((bytesPending /
    bytesTotal) * 100));
    uploadProgress.setProgress(percentage, 100);
    uploadProgress.label = "Writing: " + percentage + "%";
    if (bytesPending == 0) { event.target.close(); }
    private function newFileStream_close(event:Event):void
    var uploadURL:URLRequest = new URLRequest("
    http://localhost:8080/customers/propertypanorama_com/fileupload.php");
    var uploadFile:FileReference =
    FileReference(tempFile[currentFile]);
    uploadFile.addEventListener(ProgressEvent.PROGRESS,
    uploadFile_progress);
    uploadFile.addEventListener(Event.COMPLETE,
    uploadFile_complete);
    uploadFile.upload(uploadURL, "uploadFile");
    uploadProgress.setProgress(0, 1);
    uploadProgress.label = "";
    private function loader_complete(event:Event):void
    var loader:Loader = Loader(event.target.loader);
    var originalWidth:Number = event.target.width;
    var originalHeight:Number = event.target.height;
    var originalBitmap:BitmapData = new
    BitmapData(originalWidth, originalHeight, false, 0x000000);
    originalBitmap.draw(loader.content, null, null, null, null,
    true);
    var newImage:BitmapData = resizeImage(originalBitmap);
    var newFileStream:FileStream = new FileStream();
    newFileStream.addEventListener(OutputProgressEvent.OUTPUT_PROGRESS,
    newFileStream_progress);
    newFileStream.addEventListener(Event.CLOSE,
    newFileStream_close);
    newFileStream.openAsync(tempFile[currentFile],
    FileMode.WRITE);
    var jpgEncode:JPEGEncoder = new JPEGEncoder();
    var writeData:ByteArray = jpgEncode.encode(newImage);
    newFileStream.writeBytes(writeData, 0, writeData.length);
    private function saveAndUploadImage(originalImage:File):void
    var fromOldExt:String = originalImage.name;
    var toJPG:String;
    if (originalImage.extension.length == 4)
    toJPG = fromOldExt.substring(0, fromOldExt.length - 4) +
    "jpg";
    else
    toJPG = fromOldExt.substring(0, fromOldExt.length - 3) +
    "jpg";
    tempFile[currentFile] =
    File.applicationStorageDirectory.resolvePath(toJPG);
    var loader:Loader = new Loader();
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE,
    loader_complete);
    loader.load(new URLRequest(originalImage.nativePath));
    private function
    resizeImage(originalImage:BitmapData):BitmapData
    var originalWidth:Number = originalImage.width;
    var originalHeight:Number = originalImage.height;
    var doResize:Boolean = false;
    var scaleRatio:Number = 1;
    var newImageMatrix:Matrix;
    var newImage:BitmapData;
    var newWidth:Number = 0;
    var newHeight:Number = 0;
    doResize = (originalWidth > maxImageWidth ||
    originalHeight > maxImageHeight);
    if (doResize)
    if (originalWidth > maxImageWidth)
    scaleRatio = maxImageWidth / originalWidth;
    newWidth = originalWidth * scaleRatio;
    newHeight = originalHeight * scaleRatio;
    else
    scaleRatio = maxImageHeight / originalHeight;
    newWidth = originalWidth * scaleRatio;
    newHeight = originalHeight * scaleRatio;
    newImageMatrix = new Matrix();
    newImageMatrix.scale(scaleRatio, scaleRatio);
    newImage = new BitmapData(newWidth, newHeight, false,
    0x000000);
    newImage.draw(originalImage, newImageMatrix, null, null,
    null, true);
    newImageMatrix = null;
    return newImage;
    else
    return originalImage;
    ]]>
    </mx:Script>
    <mx:HBox width="100%" horizontalAlign="right"
    paddingLeft="2" paddingRight="2" paddingTop="2" paddingBottom="2"
    verticalAlign="middle">
    <mx:ProgressBar id="uploadProgress" label="" width="100%"
    />
    <mx:Button id="uploadButton" label="Upload"
    click="uploadButton_click(event);" />
    </mx:HBox>
    </mx:WindowedApplication>

  • Image resizing and cropping

    Hi,
    I want to convert images to thumbnails with a 'standard' format - I need all images to have the same width and height.
    So I need to resize and then crop the images. Is this possibe with JAI? Are there other libraries which can do this better?
    I've read about ImageMagick - are the Java interfaces to ImageMagick good?
    /regards, Håkan Jacobsson

    Depending on the format of your files, you need not go into JAI. You may be able to do what you want with ImageIO.
    You just need to load the image, select the part you want, then check the length to width ratio to make sure it is appropriate, if not, then adjust it as such.
    If you want to get a 100, 100 thumb from a 1024, 768 image you can do this:
    BufferedImage bi = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = bi.createGraphics();
    g.drawImage(my1024x768, 0, 12, 100, 75, Color.BLACK, null);
    g.dispose();please note, that to get 1024 shunk up to 100, you need to divide by 10.24, when you do the same to the height of the image, you get 75, this leaves 25 pixels--so I centered the image at 12.
    to save the thumb in JPG:
    File f = new File(myFileNameAndPath);
    f.createFile();
    ImageIO.write(bi, "JPEG", f);**WARNING** untested code.

  • PHP/MySQL image upload

    I am looking for an easy to understand PHP tutorial on
    uploading an image to a folder. However I would like to put a
    reference/path to the image in a MySQL batabase table.

    newhorizonhosting.com wrote:
    > I am looking for an easy to understand PHP tutorial on
    uploading an image to a folder. However I would like to put a
    reference/path to the image in a MySQL batabase table.
    The PHP online manual is pretty comprehensive on file
    uploads.
    http://www.php.net/manual/en/features.file-upload.php
    You can get the name of the file from
    $_FILES['fieldName']['name']
    (where 'fieldName' is the name of the form field that uploads
    the
    image). It's just a question of using that information to
    insert into a
    database.
    I cover image file uploads in considerable detail in "PHP
    Solutions" if
    you're interested in a more comprehensive approach.
    David Powers, Adobe Community Expert
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    Author, "PHP Solutions" (friends of ED)
    http://foundationphp.com/

  • Questions about resizing and uploading pictures ...

    I have set up a desktop folder, and can store my resized pictures there through the export function in iPhoto.  When I export though, there doesn't seem to be any way to export directly to that folder.  Instead, I have to export to the desktop, then drag all those files into my desktop folder.  Is there any way to export my resized photos directly into that folder without having to first go to the desktop, then the folder?  It just seems like extra steps.
    Another nuisance I'm encountering is uploading to sites like eBay and PhotoBucket.  If I chose to browse files on my computer, all that opens is the iPhoto icon rather than individual image files.  I know I can drag and drop, but is there any way of directly accessing either the individual images in iPhoto or the desktop shortcut which contains my resized images?
    I am coming off years of working with Windows, and their system of simply opening My Pictures and selecting the images you want to upload seems much simpler than this.
    I am running OS X Mavericks with a MacBook Air 2013.
    Thanks for any help.

    The iPhoto export dialogue is the same as any other. I wonder if you're seeing this:
    When what you want is this:
    Which allows you to access the specific folders you want. You get this by clicking the button indicated.
    As for uploading photos:
    For help accessing your photos in iPhoto see this user tip:
    https://discussions.apple.com/docs/DOC-4491
    It's the first one you want...
    You can work your photos on your Mac just like you did on Windows, but you've chosen to use a database with lossless processing. So there is a learnign curve if you change not only your OS but you're entire system of managing your photos.

  • Php & mysql images

    I have some images in a mysl table(blob field)
    does anyone have a sample to show how to display some images
    in a movie?
    Cheers
    Stevew

    Gotcha. In that case you can just make a php script to pull
    the images and
    return them. I just did a little test and it worked fine - I
    placed a jpg
    into a mediumblob field in MySQL. I then made a little PHP
    script, test.php:
    <?PHP
    include_once("../scripts/db_connect.php");
    $sql = "SELECT image FROM test WHERE id=1";
    $result = mysql_query($sql, $connection);
    $row = mysql_fetch_array($result);
    echo($row['image']);
    ?>
    Then in Flash, I simply loaded the image from the script into
    an empty
    movieClip (imClip) using:
    var lm = new MovieClipLoader();
    lm.loadClip("url/test.php", imClip);
    HTH
    Dave -
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

  • How to install and configure latest xampp, php, Mysql, apache server, and configure it with dreamvie

    Working on my next project for the tech blog Techmozilla I am trying to make php to work with Apache. . i surfed for the procedures and finally i was asked to do the below mentioned operation .. but i am unable to understand it can anyone please help me .I am using Windows XP
    # Add the following 3 lines to your httpd.conf file. You can put them anywhere in the file but maybe it makes sense to put them after the other LoadModule section.
    LoadModule php5_module "d:/Program Files/php/php5apache2_2.dll"
    AddType application/x-httpd-php .php
    PHPIniDir "D:\Program Files\php"
    Is there any other link which helps to install PHP,Apache and MySql. Please help me. Thank you in advance

    This forum is for helping people who are trying to download and install Adobe software products.  You need to find an information resource suitable to the task you are undertaking, most probably provided by whomever provided the resource(s) you are trying to install.

  • Php, mySQL, apache servers and all that malarkey...

    Hello
    I want to learn how to build databases and use dreamweaver to
    build sites to for e-commerce shops or portfolio archives etc...
    But at first glance im a bit overwhelmed. I am willing to put the
    time and effort in but just need a little point in the right
    direction.
    What should i be looking at first? Working out mySQL or
    learning .php? Ive seen a lot of talk about installing apache
    servers and installing php5 but i know absolutely ZERO about this.
    If you had to learn it all again where would you start?
    Ive got a G5 ,DW8 and a web host that supports mySQL. I have
    a bit of experience building websites and am just getting to grips
    with CSS. Do i need anything else?

    gareth:
    You may want to change this -
    Whether your new to web design,
    to this -
    Whether you're new to web design,
    and this -
    The PHP Login Suite has a comprehensive 82 manual
    to this -
    The PHP Login Suite has a comprehensive 82 page manual
    Meanwhile, I am examining the details of this product
    carefully! 8)
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.dreamweavermx-templates.com
    - Template Triage!
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    http://www.macromedia.com/support/search/
    - Macromedia (MM) Technotes
    ==================
    "gareth" <[email protected]> wrote in message
    news:e2o095$kco$[email protected]..
    >I would learn the basics of PHP first, then start looking
    at working with
    > databases once you`ve got to grips with the basics.
    >
    > If you want to learn to create E Commerce sites, then
    its going to give
    > you
    > a huge advantage if you learn to hand code rather than
    relying solely on
    > Dreamweavers server behaviors to do everything for you.
    >
    > Installing Apache and PHP is a good idea, as it allows
    you to test your
    > code
    > locally. I have some guides at:
    >
    >
    http://www.dreamweavermxsupport.com/index.php?type=article&pid=39
    >
    > Getting a bit old now, but still relevant :-)
    >
    > There are a huge number of tutorials on the web to help
    with learning PHP,
    > the home of PHP www.php.net is an essential bookmark.
    There are also a
    > large
    > number of good books out there that will help you.
    >
    > Gareth
    >
    http://www.phploginsuite.co.uk/
    > PHP Login Suite V2 - 34 Server Behaviors to build a
    complete Login system.
    >
    >

  • Images resized and exif stripped when emailed ?

    Does any know why the iPhone resizes images (to 640x480) and strips out EXIF data when you email a photo. However, if you download the photos you get the full size and EXIF data ?
    As i often like to email photos direct to Flickr from my iphone it is very annoying to end up with a poorer image than what i should have.

    Hello All,
    Great news for the Apple iPhone.
    Just downloaded 2.1 software update, and the Geotagging correctly geotags the southern hemisphere, now adds a GPS Time-Stamp as well as the GPS longitude & latitude info to the EXIF.
    AND, when you e-mail it or transmit the image to a secure server, mobleme, Flickr . . . ALLL OF THE EXIF DATA STAYS INTACT, INCLUDING THE GPS METATAGS . . .
    AND THE SIZE OF THE IMAGE HAS BEEN REDUCED FROM 1200 X 1600 TO 600 X 800 . . .

  • Image Resizing and Folio Renditions

    Hello!
    I'm building a pretty large app, and I'm concerned about the size of some of my larger images.
    A. Is it typical to build both 1024x768 and 2048x1536 renditions? Or should I just build the 1024x768 and size my full page images for the 2048x1536? Or will it automatically view them at 72dpi?
    B. If I do build both renditions, can I keep the two different layouts in the same file with alternate layout? Or would I have to build a separate folio like I would for the iPhone?
    C. What is the best format to save images in? I've always saved as jpgs, but if I'm able to save as a gif or png for file size, I'd prefer to do that. But I don't want to compromise the integrity of the photo either.
    Thank you!

    Depending on the format of your files, you need not go into JAI. You may be able to do what you want with ImageIO.
    You just need to load the image, select the part you want, then check the length to width ratio to make sure it is appropriate, if not, then adjust it as such.
    If you want to get a 100, 100 thumb from a 1024, 768 image you can do this:
    BufferedImage bi = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
    Graphics2D g = bi.createGraphics();
    g.drawImage(my1024x768, 0, 12, 100, 75, Color.BLACK, null);
    g.dispose();please note, that to get 1024 shunk up to 100, you need to divide by 10.24, when you do the same to the height of the image, you get 75, this leaves 25 pixels--so I centered the image at 12.
    to save the thumb in JPG:
    File f = new File(myFileNameAndPath);
    f.createFile();
    ImageIO.write(bi, "JPEG", f);**WARNING** untested code.

  • Image resizing and interpolation plugin

    A friend reports that genuine factals plugin is a part of Photoshop CS3. I note that a plugin for Photoshop (version not given) is advertised for sale by OnOneSoftware.
    Any comments appreciated.

    The GF plug-in is not part of Photoshop, you buy it from OnOne Software.
    John

  • Why won't Photoshop revert to earlier history state after image resize when scripted?

    I've written an Applescript to automate watermarking and resizing images for my company. Everything generally works fine — the script saves the initial history state to a variable, resizes the image, adds the appropriate watermark, saves off a jpeg, then reverts to the initial history state for another resize and watermark loop.
    The problem is when I try not to use a watermark and only resize by setting the variable `wmColor` to `"None"` or `"None for all"`. It seems that after resizing and saving off a jpeg, Photoshop doesn't like it when I try to revert to the initial history state. This is super annoying, since clearly a resize should count as a history step, and I don't want to rewrite the script to implement multiple open/close operations on the original file. Does anyone know what might be going on? This is the line that's generating the problem (it's in both the doBig and doSmall methods, and throws an error every time I ask it just to do an image resize and change current history state):
                        set current history state of current document to initialState
    and here's the whole script:
    property type_list : {"JPEG", "TIFF", "PNGf", "8BPS", "BMPf", "GIFf", "PDF ", "PICT"}
    property extension_list : {"jpg", "jpeg", "tif", "tiff", "png", "psd", "bmp", "gif", "jp2", "pdf", "pict", "pct", "sgi", "tga"}
    property typeIDs_list : {"public.jpeg", "public.tiff", "public.png", "com.adobe.photoshop-image", "com.microsoft.bmp", "com.compuserve.gif", "public.jpeg-2000", "com.adobe.pdf", "com.apple.pict", "com.sgi.sgi-image", "com.truevision.tga-image"}
    global myFolder
    global wmYN
    global wmColor
    global nameUse
    global rootName
    global nameCount
    property myFolder : ""
    -- This droplet processes files dropped onto the applet
    on open these_items
      -- FILTER THE DRAGGED-ON ITEMS BY CHECKING THEIR PROPERTIES AGAINST THE LISTS ABOVE
              set wmColor to null
              set nameCount to 0
              set nameUse to null
              if myFolder is not "" then
                        set myFolder to choose folder with prompt "Choose where to put your finished images" default location myFolder -- where you're going to store the jpgs
              else
                        set myFolder to choose folder with prompt "Choose where to put your finished images" default location (path to desktop)
              end if
              repeat with i from 1 to the count of these_items
                        set totalFiles to count of these_items
                        set this_item to item i of these_items
                        set the item_info to info for this_item without size
                        if folder of the item_info is true then
      process_folder(this_item)
                        else
                                  try
                                            set this_extension to the name extension of item_info
                                  on error
                                            set this_extension to ""
                                  end try
                                  try
                                            set this_filetype to the file type of item_info
                                  on error
                                            set this_filetype to ""
                                  end try
                                  try
                                            set this_typeID to the type identifier of item_info
                                  on error
                                            set this_typeID to ""
                                  end try
                                  if (folder of the item_info is false) and (alias of the item_info is false) and ((this_filetype is in the type_list) or (this_extension is in the extension_list) or (this_typeID is in typeIDs_list)) then
      -- THE ITEM IS AN IMAGE FILE AND CAN BE PROCESSED
      process_item(this_item)
                                  end if
                        end if
              end repeat
    end open
    -- this sub-routine processes folders
    on process_folder(this_folder)
              set these_items to list folder this_folder without invisibles
              repeat with i from 1 to the count of these_items
                        set this_item to alias ((this_folder as Unicode text) & (item i of these_items))
                        set the item_info to info for this_item without size
                        if folder of the item_info is true then
      process_folder(this_item)
                        else
                                  try
                                            set this_extension to the name extension of item_info
                                  on error
                                            set this_extension to ""
                                  end try
                                  try
                                            set this_filetype to the file type of item_info
                                  on error
                                            set this_filetype to ""
                                  end try
                                  try
                                            set this_typeID to the type identifier of item_info
                                  on error
                                            set this_typeID to ""
                                  end try
                                  if (folder of the item_info is false) and (alias of the item_info is false) and ((this_filetype is in the type_list) or (this_extension is in the extension_list) or (this_typeID is in typeIDs_list)) then
      -- THE ITEM IS AN IMAGE FILE AND CAN BE PROCESSED
      process_item(this_item)
                                  end if
                        end if
              end repeat
    end process_folder
    -- this sub-routine processes files
    on process_item(this_item)
              set this_image to this_item as text
              tell application id "com.adobe.photoshop"
                        set saveUnits to ruler units of settings
                        set display dialogs to never
      open file this_image
                        if wmColor is not in {"None for all", "White for all", "Black for all"} then
                                  set wmColor to choose from list {"None", "None for all", "Black", "Black for all", "White", "White for all"} with prompt "What color should the watermark be?" default items "White for all" without multiple selections allowed and empty selection allowed
                        end if
                        if wmColor is false then
                                  error number -128
                        end if
                        if nameUse is not "Just increment this for all" then
                                  set nameBox to display dialog "What should I call these things?" default answer ("image") with title "Choose the name stem for your images" buttons {"Cancel", "Just increment this for all", "OK"} default button "Just increment this for all"
                                  set nameUse to button returned of nameBox -- this will determine whether or not to increment stem names
                                  set rootName to text returned of nameBox -- this will be the root part of all of your file names
                                  set currentName to rootName
                        else
                                  set nameCount to nameCount + 1
                                  set currentName to rootName & (nameCount as text)
                        end if
                        set thisDocument to current document
                        set initialState to current history state of thisDocument
                        set ruler units of settings to pixel units
              end tell
      DoSmall(thisDocument, currentName, initialState)
      DoBig(thisDocument, currentName, initialState)
              tell application id "com.adobe.photoshop"
                        close thisDocument without saving
                        set ruler units of settings to saveUnits
              end tell
    end process_item
    to DoSmall(thisDocument, currentName, initialState)
              tell application id "com.adobe.photoshop"
                        set initWidth to width of thisDocument
                        if initWidth < 640 then
      resize image thisDocument width 640 resample method bicubic smoother
                        else if initWidth > 640 then
      resize image thisDocument width 640 resample method bicubic sharper
                        end if
                        set myHeight to height of thisDocument
                        set myWidth to width of thisDocument
                        if wmColor is in {"White", "White for all"} then
                                  set wmFile to (path to resource "water_250_white.png" in bundle path to me) as text
                        else if wmColor is in {"Black", "Black for all"} then
                                  set wmFile to (path to resource "water_250_black.png" in bundle path to me) as text
                        end if
                        if wmColor is not in {"None", "None for all"} then
      open file wmFile
                                  set wmDocument to current document
                                  set wmHeight to height of wmDocument
                                  set wmWidth to width of wmDocument
      duplicate current layer of wmDocument to thisDocument
                                  close wmDocument without saving
      translate current layer of thisDocument delta x (myWidth - wmWidth - 10) delta y (myHeight - wmHeight - 10)
                                  set opacity of current layer of thisDocument to 20
                        end if
                        set myPath to (myFolder as text) & (currentName) & "_640"
                        set myOptions to {class:JPEG save options, embed color profile:false, quality:12}
      save thisDocument as JPEG in file myPath with options myOptions appending lowercase extension
                        set current history state of current document to initialState
              end tell
    end DoSmall
    to DoBig(thisDocument, currentName, initialState)
              tell application id "com.adobe.photoshop"
                        set initWidth to width of thisDocument
                        if initWidth < 1020 then
      resize image thisDocument width 1020 resample method bicubic smoother
                        else if initWidth > 1020 then
      resize image thisDocument width 1020 resample method bicubic sharper
                        end if
                        set myHeight to height of thisDocument
                        set myWidth to width of thisDocument
                        if wmColor is in {"White", "White for all"} then
                                  set wmFile to (path to resource "water_400_white.png" in bundle path to me) as text
                        else if wmColor is in {"Black", "Black for all"} then
                                  set wmFile to (path to resource "water_400_black.png" in bundle path to me) as text
                        end if
                        if wmColor is not in {"None", "None for all"} then
      open file wmFile
                                  set wmDocument to current document
                                  set wmHeight to height of wmDocument
                                  set wmWidth to width of wmDocument
      duplicate current layer of wmDocument to thisDocument
                                  close wmDocument without saving
      translate current layer of thisDocument delta x (myWidth - wmWidth - 16) delta y (myHeight - wmHeight - 16)
                                  set opacity of current layer of thisDocument to 20
                        end if
                        set myPath to (myFolder as text) & (currentName) & "_1020"
                        set myOptions to {class:JPEG save options, embed color profile:false, quality:12}
      save thisDocument as JPEG in file myPath with options myOptions appending lowercase extension
                        set current history state of current document to initialState
              end tell
    end DoBig

    As many others here I use JavaScript so I can’t really help you with your problem.
    But I’d like to point to »the lazy person’s out« – with many operations that result in creating a new file on disk I simply duplicate the image (and flatten in the same step) to minimize any chance of damaging the original file if the Script should not perform as expected.

  • PSE5 Process Multiple Files Image Resize

    I want to batch convert some TIFF files to JPG and make them all 300 ppi. I tried suing the Multiple file processor in the Editor just entering 300 in resolution and leaving width & height blank. I hoped it would perform the same process as going to image resize and and changing resolution with resample and constrain proportions turned off. Instead it has changed the ppi from 72 to 300, but kept the size the same i.e. has added lots of extra pixels making the file enormous.
    The only way I can force it to shrink the image is to enter say 30cm as the width. The problem with this is twofold a) I have to trun all my photos so they are landscape b) if I have cropped a photo such that it doesn't have enough pixels to stretch then again it is getting resampled.
    Is this a limitation of PSE5 that wouldn't be there in CS3 or am I doing something wrong? I only want to print tham out 15x10 but read I should resize everything to 300 ppi. To be honest I never did this before I had PSE and they seemed to come out OK from a Canon that saves the files as default 72 ppi but large dimensions. Maybe someone couldexplain in laymans terms why the photos need to be resized to 300 ppi anyway? Thank you

    Well, you see, Process Multiple files is doing just what you asked it to do: it's
    resizing the photos. But you don't really want to resize the photos, just change the ppi setting. Is there a particular reason you want them to be 300ppi? PPI is a setting that only matters for printing or if you are sending a photo somewhere that requires that marker to be set to 300. Your camera doesn't know anything about ppi, only absolute pixel dimensions (eg 2480 x 1795 or whatever).
    When you go to print, however, your printer may prefer to have a higher pixel density, since it can play your pixels like an accordian: squash them closer together or spread them out thinner, depending on that ppi marker. The pixel density determines the inch/cm size of your print (at 72 ppi you'll get a print that's hugely bigger but less detailed; at 300 ppi a crisper smaller print.)
    I'm wondering why you would want to batch convert a whole big bunch of images at once, though. It would help if you would explain just what you want to do with the photos that requires the 300 ppi.

  • Resize and Resample in Photoshop CC

    Hi.
    I use Photoshop since 1997 and jump from CS5 to CC this week. What I used to do sometimes is taking a 150dpi image and need to make it 72dpi, BUT I really want it to change pixels dimension. In PS CS5 I just needed to go to "Image Resize" and change 150 do 72dpi, and PS kept the Cm/Inches dimensions but changed pixels. Is exactly what I need to do. I PS CC it doesn't work, if I change dpi it will only change image size in Cm/Inches.
    And example, I have an Illustrator file, 800x800px. I export it as 150dpi JPG, opens in PS. It will show an image like 1667x1667px 150dpi. I want to change it to 72dpi so my JPG will be 800x800px again.
    Some people will say: "but why don't you already export from ILL as 72dpi?". Because I sometimes need those images in 150 and sometimes in 72. So I prefer to have a 150dpi image and resize to 72 if I need instead the opposite.
    Do you know if there is a way in PS CC to solve it?
    Thanks,
    Luiz

    DPI PPI  and an image's DPI resolution setting and Inkjet Printers DPI Resolution setting ???
    Dots Per Inch is an old printers term that came about when images were printed black and white using little dots of inks fined dots finer sharper images it density of dots size of dots image like news papers.  Later color image usinf 4 colors CMYK...
    Pixels Per Inch a term use about displays color pixels are three color Red Green Blue their geometry layout varies and some have even added a fourth yellow component  again its a density size display are manufactured with a single PPI density.  Different displays panels have their manufactured PPI. Most desktop LCD panels today have a ppi around 100.  Displays do not support your Image Files DPI resolution setting the display pixels their PPI size.  Image sizing on displays is done by scaling  the numbers of pixels in a image a displaying the scaled image not the actual images pixel. Zooming percent....
    Inkjets printers do not print like news papers and the do not use a single drop or dot of ink per image pixel.  The user their higher finer drops of ink to paint in you images larger square pixels. You inkjet printer can print pixels and siy up to the maximum resolution. Your printer DPI setting is a quality setting the higher the setting the finer the pixels will be painted in.  Higher quality settings are only available on high quality Photo paper for more ink is laid down and requires a special surface to prevent ink running pixels together regular paper would receive to much ink and be more a blotter paper.
    Image DPI setting defines/sets the image Pixel size without changing a single pixel in am image you can print the image any size you want by changing the size of its pixels.

Maybe you are looking for