Jump to content

Barand

Moderators
  • Posts

    24,604
  • Joined

  • Last visited

  • Days Won

    830

Everything posted by Barand

  1. If you are having problems why have you commented out the two lines at the top that might tell you why you are having those problems?
  2. You need to assign the value returned by your function to a variable. $photoFiles = getPhotoFilesArray($photoPath); var_dump($photoFiles); I suggest you read up on how to use functions variable scope
  3. Not necessarily TABLE customer TABLE customer_order +--------------+ +------------------+ | customer_id | | order_no | | cust_name | | order_date | | address | | customer_id | +--------------+ | deliver_to | +------------------+ SELECT cust_name , order_no , order_date , COALESCE(deliver_to, address) as deliver_to FROM customer_order o JOIN customer c USING (customer_id)
  4. TABLE addya TABLE addyb +----+-----------+-----------+ +----+-----------+-----------+ | id | address1 | address2 | | id | address1 | address2 | +----+-----------+-----------+ +----+-----------+-----------+ | 1 | add A 1 1 | add A 1 2 | | 1 | add B 1 1 | add B 1 2 | | 2 | add A 2 1 | add A 2 2 | | 2 | NULL | NULL | | 3 | NULL | NULL | | 3 | add B 3 1 | add B 3 2 | +----+-----------+-----------+ +----+-----------+-----------+ SELECT id , COALESCE(a.address1, b.address1) as add1 , COALESCE(a.address2, b.address2) as add2 FROM addya a JOIN addyb b USING(id); +----+-----------+-----------+ | id | add1 | add2 | +----+-----------+-----------+ | 1 | add A 1 1 | add A 1 2 | | 2 | add A 2 1 | add A 2 2 | | 3 | add B 3 1 | add B 3 2 | +----+-----------+-----------+
  5. Use the COALESCE() function
  6. Yes, or do them both in the same operation. Not in the image. If you store the original image then you can still get it any time you want it.. You would have to amend your rotation function as it currently overwrites the input file.
  7. When you resize, or rotate, you are creating a new copied image using the GD library. This copy loses the exif data that the original contains.
  8. Then you destroyed the exif info.
  9. From your "BEFORE" exif data (above) it was created by GD library in PHP. Uploading should just copy the file. Are you doing any PHP processing on the file after uploading, such as resizing? My image was copied from my camera to my PC.
  10. I don't see any "orientation" index in your exif data. My "BEFORE" exif data looks like this (as you can see, orientation = 8)... Array ( [FileName] => DSCN0035.JPG [FileDateTime] => 1528993833 [FileSize] => 4044525 [FileType] => 2 [MimeType] => image/jpeg [SectionsFound] => ANY_TAG, IFD0, THUMBNAIL, EXIF, GPS, INTEROP, MAKERNOTE [COMPUTED] => Array ( [html] => width="4896" height="3672" [Height] => 3672 [Width] => 4896 [IsColor] => 1 [ByteOrderMotorola] => 0 [ApertureFNumber] => f/5.8 [UserComment] => [UserCommentEncoding] => UNDEFINED [Thumbnail.FileType] => 2 [Thumbnail.MimeType] => image/jpeg ) [ImageDescription] => [Make] => NIKON [Model] => COOLPIX P520 [Orientation] => 8 <<*************** ORIENTATION ************** [XResolution] => 300/1 [YResolution] => 300/1 [ResolutionUnit] => 2 [Software] => COOLPIX P520 V1.0 [DateTime] => 2014:06:30 13:33:43 [YCbCrPositioning] => 2 [Exif_IFD_Pointer] => 314 [GPS_IFD_Pointer] => 1002 [THUMBNAIL] => Array ( [Compression] => 6 [XResolution] => 300/1 [YResolution] => 300/1 [ResolutionUnit] => 2 [JPEGInterchangeFormat] => 4032 [JPEGInterchangeFormatLength] => 4658 ) [ExposureTime] => 10/6400 [FNumber] => 58/10 [ExposureProgram] => 3 [ISOSpeedRatings] => 80 [UndefinedTag:0x8830] => 1 [ExifVersion] => 0230 [DateTimeOriginal] => 2014:06:30 13:33:43 [DateTimeDigitized] => 2014:06:30 13:33:43 [ComponentsConfiguration] => [CompressedBitsPerPixel] => 2/1 [ExposureBiasValue] => 0/10 [MaxApertureValue] => 32/10 [MeteringMode] => 5 [LightSource] => 0 [Flash] => 16 [FocalLength] => 356/10 [MakerNote] => Nikon [UserComment] => [FlashPixVersion] => 0100 [ColorSpace] => 1 [ExifImageWidth] => 4896 [ExifImageLength] => 3672 [InteroperabilityOffset] => 1114 [FileSource] => [SceneType] => [CustomRendered] => 0 [ExposureMode] => 0 [WhiteBalance] => 0 [DigitalZoomRatio] => 0/100 [FocalLengthIn35mmFilm] => 200 [SceneCaptureType] => 0 [GainControl] => 0 [Contrast] => 0 [Saturation] => 0 [Sharpness] => 0 [SubjectDistanceRange] => 0 [GPSVersion] => [InterOperabilityIndex] => R98 [InterOperabilityVersion] => 0100 ) As for your question about print_r(), see the manual
  11. Post the exif data
  12. For the function to create a new file, the original image must have an orientation value and that value must be something other than 1. If it is 3, 6, or 8 it is rotated.
  13. I'll have to pass on that. Did the output of your original's exif data contain the "Orientation" value? In my test, the original had an orientation = 8. Here's the before and after <img src="images/DSCN0035.JPG" width="500" > <img src="images/RDSCN0035.JPG" height="500" > <!-- rotated version --> Results
  14. I tried your function then pulled the exif data from the rotated image. Virtually all of the mass of data from the original has gone, including the "Orientation". Width and height were updated OK.'' Exif from new image Array ( [FileName] => RDSCN0035.JPG [FileDateTime] => 1575484231 [FileSize] => 3509919 [FileType] => 2 [MimeType] => image/jpeg [SectionsFound] => COMMENT [COMPUTED] => Array ( [html] => width="3672" height="4896" [Height] => 4896 [Width] => 3672 [IsColor] => 1 ) [COMMENT] => Array ( [0] => CREATOR: gd-jpeg v1.0 (using IJG JPEG v90), quality = 95 ) )
  15. A good start would be echo '<pre>', print_r($exif, 1), '</pre>'; after you get the exif data.
  16. You don't have anything in you input form with the name = "professional_courier" or name = "india_post", so $_POST['professional_courier'] and $_POST['india_post'] never exist. You should, therefore, be seeing messages that those $_POST indexes do not exist. If not, turn on your error reporting so you are not continually stabbing in the dark.
  17. Aha! I tried echo $data->data->"185.220.101.46"->appears; and I tried echo $data->data->{185.220.101.46}->appears; but I didn't think of trying both together.
  18. Even though the IP stops you accessing the value directly (if it's an object) as in echo $data->data->185.220.101.46->appears; … you can access it by using iteration $data = json_decode($json); // decode as object foreach ($data->data as $ip=>$ipdata) { echo "$ip : {$ipdata->appears}"; //--> 185.220.101.46 : 1 }
  19. $data = json_decode($json, true); That converts it into an array. To convert it to an object, remove the "true". $data = json_decode($json);
  20. Store the current position, n, and the array as session variables and pass the n-1 or n+1 in your hyperlinks
  21. Some complex maths is required. The array has an index, so if you are currently on the Nth element, subtract 1 to get the previous item or add 1 to get the next $current = $files[$n]; $previous = $files[$n-1]; $next = $files[$n+1];
  22. Stop blindly copying and pasting. Apply a little thought to what the code is doing. You'll learn more that way. function random_title () { $titles = file (“titles.txt”, FILE_IGNORE_NEW_LINES); $random_title = $titles[array_rand($titles)]; return ucwords($random_title); }
  23. It isn't a sound method. Suppose you have 3 titles. intval(count($titles)/3) = 1, so you now get a random integer between 0 and 1 which you multiply by 3. Therefore $num will be 0 or 3. The titles are indexed 0, 1 and 2. IE index 3 doesn't exist. See the problem? Use array_rand() $random_title = $titles[array_rand($titles)];
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.